Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse the layer order in side panel #85

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 34 additions & 30 deletions packages/base/src/panelview/components/layers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,23 @@ function LayersBodyComponent(props: IBodyProps): JSX.Element {

return (
<div id="jp-gis-layer-tree">
{layerTree.map(layer =>
typeof layer === 'string' ? (
<LayerComponent
gisModel={model}
layerId={layer}
onClick={onItemClick}
/>
) : (
<LayerGroupComponent
gisModel={model}
group={layer}
onClick={onItemClick}
/>
)
)}
{layerTree
.reverse()
.map(layer =>
typeof layer === 'string' ? (
<LayerComponent
gisModel={model}
layerId={layer}
onClick={onItemClick}
/>
) : (
<LayerGroupComponent
gisModel={model}
group={layer}
onClick={onItemClick}
/>
)
)}
</div>
);
}
Expand Down Expand Up @@ -210,21 +212,23 @@ function LayerGroupComponent(props: ILayerGroupProps): JSX.Element {
</div>
{open && (
<div>
{layers.map(layer =>
typeof layer === 'string' ? (
<LayerComponent
gisModel={gisModel}
layerId={layer}
onClick={onClick}
/>
) : (
<LayerGroupComponent
gisModel={gisModel}
group={layer}
onClick={onClick}
/>
)
)}
{layers
.reverse()
.map(layer =>
typeof layer === 'string' ? (
<LayerComponent
gisModel={gisModel}
layerId={layer}
onClick={onClick}
/>
) : (
<LayerGroupComponent
gisModel={gisModel}
group={layer}
onClick={onClick}
/>
)
)}
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/tests/contextmenu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ test.describe('context menu', () => {
await page.getByText('level 1 group').click();
await page.getByText('level 2 group').click();

const group = page.getByText('level 2 groupRegions FranceOpen Topo Map');
const group = page.getByText('level 2 groupOpen Topo MapRegions France');

await expect(group).toHaveCount(1);
});
Expand Down
11 changes: 6 additions & 5 deletions ui-tests/tests/left-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
'.jp-gis-layer .jp-gis-layerIcon svg'
);

await expect(layerIcons.first()).toHaveAttribute(

Check failure on line 98 in ui-tests/tests/left-panel.spec.ts

View workflow job for this annotation

GitHub Actions / Integration tests

tests/left-panel.spec.ts:92:9 › #layerPanel › with GIS document › raster layer should have icons

1) tests/left-panel.spec.ts:92:9 › #layerPanel › with GIS document › raster layer should have icons Error: Timed out 5000ms waiting for expect(locator).toHaveAttribute(expected) Locator: locator('#jupytergis\\:\\:leftControlPanel').locator('.jp-gis-layerPanel').locator('.jp-gis-layer .jp-gis-layerIcon svg').first() Expected string: "jupytergis::raster" Received string: "" Call log: - expect.toHaveAttribute with timeout 5000ms - waiting for locator('#jupytergis\\:\\:leftControlPanel').locator('.jp-gis-layerPanel').locator('.jp-gis-layer .jp-gis-layerIcon svg').first() 96 | ); 97 | > 98 | await expect(layerIcons.first()).toHaveAttribute( | ^ 99 | 'data-icon', 100 | 'jupytergis::raster' 101 | ); at /home/runner/work/jupytergis/jupytergis/ui-tests/tests/left-panel.spec.ts:98:40
'data-icon',
'jupytergis::raster'
);
Expand All @@ -104,17 +104,18 @@
test('should navigate in nested groups', async ({ page }) => {
const layerTree = await openLayerTree(page);
const layerEntries = layerTree.locator('.jp-gis-layerItem');
const layerGroups = layerTree.locator('.jp-gis-layerGroup');

await expect(layerEntries).toHaveCount(2);
await expect(layerEntries.first()).toHaveClass(/jp-gis-layer/);
await expect(layerEntries.last()).toHaveClass(/jp-gis-layerGroup/);
await expect(layerEntries.first()).toHaveClass(/jp-gis-layerGroup/);
await expect(layerEntries.last()).toHaveClass(/jp-gis-layer/);

// Open the first level group
await layerEntries.last().click();
await layerGroups.first().click();
await expect(layerEntries).toHaveCount(4);

// Open the second level group
await layerEntries.last().click();
await layerGroups.last().click();
await expect(layerEntries).toHaveCount(5);
});

Expand Down Expand Up @@ -171,7 +172,7 @@
const hideLayerButton = layerTree.getByTitle('Hide layer');

// Hide the last layer (top in z-index).
await hideLayerButton.last().click();
await hideLayerButton.first().click();
// wait for a significant change in the screenshots (1%).
await page.waitForCondition(async () => {
try {
Expand Down
Loading