@eox/layercontrol 0.21.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/eox-layercontrol.js +1360 -1216
- package/dist/eox-layercontrol.umd.cjs +220 -147
- package/package.json +10 -13
- package/src/components/add-layers.js +416 -0
- package/src/components/layer-config.js +212 -0
- package/src/components/layer-datetime.js +128 -0
- package/src/components/layer-group.js +193 -0
- package/src/components/layer-legend.js +135 -0
- package/src/components/layer-list.js +209 -0
- package/src/components/layer-tools.js +353 -0
- package/src/components/layer.js +244 -0
- package/src/components/optional-list.js +124 -0
- package/src/components/tab-sliders.js +0 -0
- package/src/components/tools-items.js +199 -0
- package/src/enums/index.js +16 -0
- package/src/enums/stories/assets/cropomhusc-feature-collection.json +5274 -0
- package/src/enums/stories/index.js +536 -0
- package/src/helpers/check-properties.js +41 -0
- package/src/helpers/clean-json-input.js +29 -0
- package/src/helpers/create-sortable.js +104 -0
- package/src/helpers/detect-map-url-type.js +20 -0
- package/src/helpers/fetch-capabilities.js +32 -0
- package/src/helpers/filter-layers.js +45 -0
- package/src/helpers/get-layer-type.js +35 -0
- package/src/helpers/get-legend-config.js +25 -0
- package/src/helpers/get-start-vals.js +73 -0
- package/src/helpers/hide-layers-based-on-property.js +11 -0
- package/src/helpers/index.js +22 -0
- package/src/helpers/is-layer-json-valid.js +19 -0
- package/src/helpers/is-layer-visible-based-on-zoom-state.js +31 -0
- package/src/helpers/is-layer-zoom-state-req.js +17 -0
- package/src/helpers/is-map-url-valid.js +22 -0
- package/src/helpers/layer-tools.js +82 -0
- package/src/helpers/update-url.js +32 -0
- package/src/main.js +269 -0
- package/src/methods/add-layer/add-layer.js +33 -0
- package/src/methods/add-layer/index.js +8 -0
- package/src/methods/add-layer/json-input-change.js +15 -0
- package/src/methods/add-layer/open-close-tab.js +21 -0
- package/src/methods/add-layer/url-input-change.js +17 -0
- package/src/methods/add-layer/url-layer.js +37 -0
- package/src/methods/add-layer/wms-search-url.js +44 -0
- package/src/methods/layer/first-updated.js +65 -0
- package/src/methods/layer/index.js +4 -0
- package/src/methods/layer/input-click.js +43 -0
- package/src/methods/layer-config/apply-updated-styles.js +98 -0
- package/src/methods/layer-config/data-change.js +44 -0
- package/src/methods/layer-config/index.js +7 -0
- package/src/methods/layer-list/first-updated.js +55 -0
- package/src/methods/layer-list/index.js +3 -0
- package/src/methods/layercontrol/first-update.js +22 -0
- package/src/methods/layercontrol/index.js +4 -0
- package/src/methods/layercontrol/layer-list-change.js +23 -0
- package/src/methods/optional-list/add-to-list.js +44 -0
- package/src/methods/optional-list/index.js +3 -0
- package/test/_mockMap.js +0 -154
- package/test/cases/general/check-layer-size.js +0 -25
- package/test/cases/general/check-pre-open-layer-tools.js +0 -26
- package/test/cases/general/check-pre-open-section.js +0 -29
- package/test/cases/general/disable-drag.js +0 -26
- package/test/cases/general/empty-groups.js +0 -41
- package/test/cases/general/exclusive-layers.js +0 -35
- package/test/cases/general/hide-layers.js +0 -23
- package/test/cases/general/index.js +0 -9
- package/test/cases/general/render-optional-layer.js +0 -31
- package/test/cases/general/show-layer-title.js +0 -23
- package/test/cases/layer-update/add-external-layer.js +0 -96
- package/test/cases/layer-update/add-layer-from-optional.js +0 -51
- package/test/cases/layer-update/check-if-layer-pushed-to-group.js +0 -33
- package/test/cases/layer-update/check-layer-changed-event.js +0 -29
- package/test/cases/layer-update/check-layer-is-pushed-to-root.js +0 -22
- package/test/cases/layer-update/check-layer-removed-from-group.js +0 -33
- package/test/cases/layer-update/check-layer-removed-from-root.js +0 -27
- package/test/cases/layer-update/check-layer-size-after-multiple-calls.js +0 -34
- package/test/cases/layer-update/check-layer-zoom-state.js +0 -54
- package/test/cases/layer-update/index.js +0 -9
- package/test/general.cy.js +0 -57
- package/test/layersUpdate.cy.js +0 -72
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
const DUMMY_API_RESPONSE = [
|
|
2
|
-
"GET",
|
|
3
|
-
"https://ows.mundialis.de/services/service?SERVICE=WMS&REQUEST=GetCapabilities",
|
|
4
|
-
{
|
|
5
|
-
statusCode: 200,
|
|
6
|
-
headers: { "Content-Type": "application/vnd.ogc.wms_xml" },
|
|
7
|
-
body: `<?xml version="1.0"?> <WMT_MS_Capabilities version="1.1.1"> <Capability> <Layer queryable="1"> <Title>OpenStreetMap WMS</Title> <Layer queryable="1"> <Name>bar</Name> </Layer> </Layer> </Capability> </WMT_MS_Capabilities>`,
|
|
8
|
-
},
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
const DUMMY_JSON = `{ type: "Tile", properties: { id: "baz", title: "baz" }}`;
|
|
12
|
-
|
|
13
|
-
const addExternalLayers = () => {
|
|
14
|
-
// Set up a mock map with a layer "foo"
|
|
15
|
-
cy.get("mock-map").and(($el) => {
|
|
16
|
-
$el[0].setLayers([{ properties: { id: "foo" } }]);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
let mapTile = "";
|
|
20
|
-
|
|
21
|
-
// Intercept API Response So that API don't fail
|
|
22
|
-
cy.intercept(...DUMMY_API_RESPONSE).as("getDummyXml");
|
|
23
|
-
|
|
24
|
-
// Add a new layer via the layer control UI
|
|
25
|
-
cy.get("eox-layercontrol")
|
|
26
|
-
.shadow()
|
|
27
|
-
.find("eox-layercontrol-add-layers")
|
|
28
|
-
.then(($el) => {
|
|
29
|
-
cy.wrap($el).within(() => {
|
|
30
|
-
// Open the add layer dialog
|
|
31
|
-
cy.get(".add-icon").click();
|
|
32
|
-
cy.get(".eox-add").should("have.class", "open");
|
|
33
|
-
|
|
34
|
-
// Input the URL to fetch layers and select the first layer in the list
|
|
35
|
-
cy.get(".add-url").type("https://ows.mundialis.de/services/service", {
|
|
36
|
-
force: true,
|
|
37
|
-
});
|
|
38
|
-
cy.get(".search-icon").as("apibtn").click();
|
|
39
|
-
cy.get("@apibtn").should("not.be.disabled");
|
|
40
|
-
|
|
41
|
-
// Select and capture the name of the added layer
|
|
42
|
-
cy.get(".add-layer-icon").first().click();
|
|
43
|
-
cy.get(".search-list")
|
|
44
|
-
.first()
|
|
45
|
-
.invoke("text")
|
|
46
|
-
.then((text) => {
|
|
47
|
-
mapTile = text.trim();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
})
|
|
51
|
-
.then(() => {
|
|
52
|
-
cy.wait("@getDummyXml")
|
|
53
|
-
.its("response")
|
|
54
|
-
.then(() => {
|
|
55
|
-
// Verify if the added layer is displayed in the layer control list
|
|
56
|
-
cy.get("eox-layercontrol")
|
|
57
|
-
.shadow()
|
|
58
|
-
.find("eox-layercontrol-layer-list")
|
|
59
|
-
.then(($el) => {
|
|
60
|
-
cy.wrap($el).first(() => {
|
|
61
|
-
cy.get("li").should("have.attr", "data-layer", mapTile);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Add another layer using a JSON configuration
|
|
68
|
-
cy.get("eox-layercontrol")
|
|
69
|
-
.shadow()
|
|
70
|
-
.find("eox-layercontrol-add-layers")
|
|
71
|
-
.then(($el) => {
|
|
72
|
-
cy.wrap($el).within(() => {
|
|
73
|
-
// Switch to the JSON tab and input the layer configuration
|
|
74
|
-
cy.get(".eox-add-layer-tab li").last().click();
|
|
75
|
-
cy.get("textarea").type(DUMMY_JSON, {
|
|
76
|
-
parseSpecialCharSequences: false,
|
|
77
|
-
force: true,
|
|
78
|
-
});
|
|
79
|
-
cy.get(".json-add-layer").as("jsonbtn").click();
|
|
80
|
-
cy.get("@jsonbtn").should("be.disabled");
|
|
81
|
-
});
|
|
82
|
-
})
|
|
83
|
-
.then(() => {
|
|
84
|
-
// Verify if the second layer is displayed in the layer control list
|
|
85
|
-
cy.get("eox-layercontrol")
|
|
86
|
-
.shadow()
|
|
87
|
-
.find("eox-layercontrol-layer-list")
|
|
88
|
-
.then(($el) => {
|
|
89
|
-
cy.wrap($el).first(() => {
|
|
90
|
-
cy.get("li").should("have.attr", "data-layer", "baz");
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export default addExternalLayers;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const addLayerFromOptional = () => {
|
|
2
|
-
// Setting up the mock map with layers and optional layers
|
|
3
|
-
cy.get("mock-map").and(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{
|
|
6
|
-
properties: {
|
|
7
|
-
title: "group1",
|
|
8
|
-
layerControlExpand: true,
|
|
9
|
-
},
|
|
10
|
-
layers: [{ properties: { title: "title1" } }],
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
properties: {
|
|
14
|
-
title: "group2",
|
|
15
|
-
layerControlExpand: true,
|
|
16
|
-
},
|
|
17
|
-
layers: [
|
|
18
|
-
{ properties: { title: "foo" } },
|
|
19
|
-
{
|
|
20
|
-
properties: {
|
|
21
|
-
id: "title2",
|
|
22
|
-
title: "title2",
|
|
23
|
-
layerControlOptional: true,
|
|
24
|
-
},
|
|
25
|
-
visible: false,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
]);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Selecting and adding the optional layer
|
|
33
|
-
cy.get("eox-layercontrol")
|
|
34
|
-
.shadow()
|
|
35
|
-
.within(() => {
|
|
36
|
-
cy.get("[data-cy='optionalLayers']").select("title2"); // Selecting the optional layer
|
|
37
|
-
cy.get("[data-cy='optionalLayers']").siblings("button").click(); // Clicking the add button
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Verifying if the added optional layer is displayed in the layer control
|
|
41
|
-
cy.get("eox-layercontrol")
|
|
42
|
-
.shadow()
|
|
43
|
-
.within(() => {
|
|
44
|
-
cy.get(".layer")
|
|
45
|
-
.find(".title")
|
|
46
|
-
.contains("title2")
|
|
47
|
-
.should("have.length", 1); // Checking if the added optional layer's title is displayed
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default addLayerFromOptional;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const checkLayerPushedToGroup = () => {
|
|
2
|
-
// Setting up the mock map with layers and a group
|
|
3
|
-
cy.get("mock-map").and(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{ properties: { title: "bar" } }, // Adding a standalone layer
|
|
6
|
-
{
|
|
7
|
-
properties: {
|
|
8
|
-
title: "group",
|
|
9
|
-
layerControlExpand: true,
|
|
10
|
-
},
|
|
11
|
-
layers: [{ properties: { title: "foo" } }], // Adding a layer to a group
|
|
12
|
-
},
|
|
13
|
-
]);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Pushing a new layer to the group
|
|
17
|
-
cy.get("mock-map").and(($el) => {
|
|
18
|
-
$el[0].map // Accessing the map
|
|
19
|
-
.getLayers() // Getting all layers
|
|
20
|
-
.getArray()[0] // Accessing the first layer (group)
|
|
21
|
-
.getLayers() // Getting layers within the group
|
|
22
|
-
.push({ properties: { title: "baz" } }); // Pushing a new layer
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Verifying if the added layer appears in the layer control
|
|
26
|
-
cy.get("eox-layercontrol")
|
|
27
|
-
.shadow()
|
|
28
|
-
.within(() => {
|
|
29
|
-
cy.get(".layer").find(".title").contains("baz"); // Checking if the title of the added layer is displayed
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default checkLayerPushedToGroup;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const checkLayerChangedEvent = () => {
|
|
2
|
-
let mockLayer;
|
|
3
|
-
|
|
4
|
-
// Set up the mock map with an initial layer
|
|
5
|
-
cy.get("mock-map").and(($el) => {
|
|
6
|
-
const mockMap = $el[0];
|
|
7
|
-
mockMap.setLayers([{ properties: { title: "foo" } }]);
|
|
8
|
-
mockLayer = mockMap.map.getLayers().getArray()[0];
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// Set up event listener
|
|
12
|
-
cy.get("eox-layercontrol").and(($el) => {
|
|
13
|
-
$el[0].addEventListener("layerchange", (evt) => {
|
|
14
|
-
if (evt.detail) {
|
|
15
|
-
// Verify if the `layerchange` event triggers with layer as `detail`
|
|
16
|
-
expect(evt.detail).to.eq(mockLayer);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Change visibility of the layer by clicking the checkbox
|
|
22
|
-
cy.get("eox-layercontrol")
|
|
23
|
-
.shadow()
|
|
24
|
-
.within(() => {
|
|
25
|
-
cy.get(".layer").find("input").click();
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default checkLayerChangedEvent;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const checkLayerIsPushedToRoot = () => {
|
|
2
|
-
// Set up the mock map with an initial layer
|
|
3
|
-
cy.get("mock-map").and(($el) => {
|
|
4
|
-
$el[0].setLayers([{ properties: { title: "foo" } }]);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
// Pushing a new layer to the root level of the map
|
|
8
|
-
cy.get("mock-map").and(($el) => {
|
|
9
|
-
$el[0].map // Accessing the map
|
|
10
|
-
.getLayers() // Getting all layers
|
|
11
|
-
.push({ properties: { title: "bar" } }); // Pushing a new layer
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Verify if the added layer appears in the layer control
|
|
15
|
-
cy.get("eox-layercontrol")
|
|
16
|
-
.shadow()
|
|
17
|
-
.within(() => {
|
|
18
|
-
cy.get(".layer").find(".title").contains("bar"); // Checking if the title of the added layer is displayed
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default checkLayerIsPushedToRoot;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const checkLayerRemovedFromGroup = () => {
|
|
2
|
-
// Set up the mock map with a group containing a layer
|
|
3
|
-
cy.get("mock-map").and(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{ title: "bar" }, // Another separate layer outside the group
|
|
6
|
-
{
|
|
7
|
-
properties: {
|
|
8
|
-
title: "group",
|
|
9
|
-
layerControlExpand: true,
|
|
10
|
-
},
|
|
11
|
-
layers: [{ properties: { title: "baz" } }], // Initial layer in the group
|
|
12
|
-
},
|
|
13
|
-
]);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// Remove the last layer from the group
|
|
17
|
-
cy.get("mock-map").and(($el) => {
|
|
18
|
-
$el[0].map
|
|
19
|
-
.getLayers() // Get all layers
|
|
20
|
-
.getArray()[0] // Access the group layer
|
|
21
|
-
.getLayers() // Get layers within the group
|
|
22
|
-
.pop(); // Remove the last layer
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Verify if the removed layer does not exist in the layer control
|
|
26
|
-
cy.get("eox-layercontrol")
|
|
27
|
-
.shadow()
|
|
28
|
-
.within(() => {
|
|
29
|
-
cy.get(".layer").find(".title").contains("baz").should("not.exist"); // Check if the removed layer is not present
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default checkLayerRemovedFromGroup;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const checkLayerRemovedFromRoot = () => {
|
|
2
|
-
// Set up the mock map with two layers
|
|
3
|
-
cy.get("mock-map").and(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{ properties: { id: "foo" } },
|
|
6
|
-
{ properties: { id: "bar" } },
|
|
7
|
-
]);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const layerToDelete = "foo"; // Layer to be deleted
|
|
11
|
-
|
|
12
|
-
// Perform the UI interactions to remove the specified layer
|
|
13
|
-
cy.get("eox-layercontrol")
|
|
14
|
-
.shadow()
|
|
15
|
-
.within(() => {
|
|
16
|
-
// Click on the 'tools' button of the layer to show additional options
|
|
17
|
-
cy.get(`[data-layer=${layerToDelete}] .tools > summary`).click();
|
|
18
|
-
|
|
19
|
-
// Click on the 'remove' icon to delete the layer
|
|
20
|
-
cy.get("button.remove-icon:visible").first().click();
|
|
21
|
-
|
|
22
|
-
// Check if the layer UI element is removed from the layer control
|
|
23
|
-
cy.get(`[data-layer=${layerToDelete}]`).should("not.exist");
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default checkLayerRemovedFromRoot;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const checkLayerSizeAfterMultipleCalls = () => {
|
|
2
|
-
// Set layers in three different rounds
|
|
3
|
-
cy.get("mock-map").then(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{ properties: { title: "1st round - foo" } },
|
|
6
|
-
{ properties: { title: "1st round - bar" } },
|
|
7
|
-
]);
|
|
8
|
-
|
|
9
|
-
// Clear all layers
|
|
10
|
-
$el[0].setLayers([]);
|
|
11
|
-
|
|
12
|
-
// Set new layers in the second round
|
|
13
|
-
$el[0].setLayers([
|
|
14
|
-
{ properties: { title: "2nd round - baz" } },
|
|
15
|
-
{ properties: { title: "2nd round - qux" } },
|
|
16
|
-
]);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
let numberOfLayers;
|
|
20
|
-
|
|
21
|
-
// Get the number of layers on the map after the operations
|
|
22
|
-
cy.get("mock-map").then(($el) => {
|
|
23
|
-
numberOfLayers = $el[0].map.getLayers().getArray().length;
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Verify if the layer control UI reflects the correct number of layers
|
|
27
|
-
cy.get("eox-layercontrol")
|
|
28
|
-
.shadow()
|
|
29
|
-
.within(() => {
|
|
30
|
-
cy.get(".layers").find("li").should("have.length", numberOfLayers);
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default checkLayerSizeAfterMultipleCalls;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const checkLayerZoomState = () => {
|
|
2
|
-
// Set layers with defined minZoom and maxZoom
|
|
3
|
-
cy.get("mock-map").then(($el) => {
|
|
4
|
-
$el[0].setLayers([
|
|
5
|
-
{ properties: { id: "foo" }, minZoom: 2 }, // Layer 'foo' visible from zoom level 2
|
|
6
|
-
{ properties: { id: "bar" }, maxZoom: 9 }, // Layer 'bar' visible till zoom level 9
|
|
7
|
-
]);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
// Utility functions to check the class presence based on zoom level
|
|
11
|
-
const checkLayerClass = (id, have) => {
|
|
12
|
-
const haveCheck = !have ? "not." : "";
|
|
13
|
-
cy.get(`[data-layer=${id}] .layer`).should(
|
|
14
|
-
`${haveCheck}have.class`,
|
|
15
|
-
"zoom-state-invisible"
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const changeZoom = (zoom) => {
|
|
20
|
-
// Update the map's zoom level and trigger the change event
|
|
21
|
-
cy.get("mock-map").then(($el) => {
|
|
22
|
-
$el[0].setZoom(zoom);
|
|
23
|
-
$el[0].map.getEvents()["change:resolution"].map((func) => func());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Case 1: Default load with zoom level 1
|
|
28
|
-
cy.get("eox-layercontrol")
|
|
29
|
-
.shadow()
|
|
30
|
-
.within(() => {
|
|
31
|
-
checkLayerClass("foo", true); // Layer 'foo' should be visible at zoom level 1
|
|
32
|
-
checkLayerClass("bar"); // Layer 'bar' should be visible at zoom level 1
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Case 2: Change zoom level to 3
|
|
36
|
-
changeZoom(3);
|
|
37
|
-
cy.get("eox-layercontrol")
|
|
38
|
-
.shadow()
|
|
39
|
-
.within(() => {
|
|
40
|
-
checkLayerClass("foo"); // Layer 'foo' should be invisible at zoom level 3
|
|
41
|
-
checkLayerClass("bar"); // Layer 'bar' should be visible at zoom level 3
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Case 3: Change zoom level to 10
|
|
45
|
-
changeZoom(10);
|
|
46
|
-
cy.get("eox-layercontrol")
|
|
47
|
-
.shadow()
|
|
48
|
-
.within(() => {
|
|
49
|
-
checkLayerClass("foo"); // Layer 'foo' should be visible at zoom level 10
|
|
50
|
-
checkLayerClass("bar", true); // Layer 'bar' should be invisible at zoom level 10
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default checkLayerZoomState;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { default as checkLayerIsPushedToRoot } from "./check-layer-is-pushed-to-root";
|
|
2
|
-
export { default as checkLayerSizeAfterMultipleCalls } from "./check-layer-size-after-multiple-calls";
|
|
3
|
-
export { default as checkLayerPushedToGroup } from "./check-if-layer-pushed-to-group";
|
|
4
|
-
export { default as checkLayerRemovedFromRoot } from "./check-layer-removed-from-root";
|
|
5
|
-
export { default as checkLayerRemovedFromGroup } from "./check-layer-removed-from-group";
|
|
6
|
-
export { default as addLayerFromOptional } from "./add-layer-from-optional";
|
|
7
|
-
export { default as checkLayerZoomState } from "./check-layer-zoom-state";
|
|
8
|
-
export { default as addExternalLayers } from "./add-external-layer";
|
|
9
|
-
export { default as checkLayerChangedEvent } from "./check-layer-changed-event";
|
package/test/general.cy.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Importing test cases and necessary modules
|
|
2
|
-
import "../src/main"; // Importing main module
|
|
3
|
-
import "./_mockMap";
|
|
4
|
-
import {
|
|
5
|
-
checkLayerSize,
|
|
6
|
-
checkPreOpenLayerTools,
|
|
7
|
-
checkPreOpenSection,
|
|
8
|
-
disableDrag,
|
|
9
|
-
exclusiveLayers,
|
|
10
|
-
hideLayers,
|
|
11
|
-
emptyGroup,
|
|
12
|
-
renderOptionalLayer,
|
|
13
|
-
showCorrectLayerTitle,
|
|
14
|
-
} from "./cases/general";
|
|
15
|
-
|
|
16
|
-
describe("LayerControl", () => {
|
|
17
|
-
// Set up before each test
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
// Mounting mock map and layer control components for testing
|
|
20
|
-
cy.mount("<mock-map></mock-map>").as("mock-map");
|
|
21
|
-
cy.mount(`<eox-layercontrol for="mock-map"></eox-layercontrol>`).as(
|
|
22
|
-
"eox-layercontrol"
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// Test to verify if the layer control is successfully loaded
|
|
27
|
-
it("loads the layer control", () => cy.get("eox-layercontrol").shadow());
|
|
28
|
-
|
|
29
|
-
// Test to ensure that the correct number of layers is displayed
|
|
30
|
-
it("displays the correct amount of layers", () => checkLayerSize());
|
|
31
|
-
|
|
32
|
-
// Test to validate the hiding of layers
|
|
33
|
-
it("hides layers correctly", () => hideLayers());
|
|
34
|
-
|
|
35
|
-
// Test to verify that layers with `layerContorlExclusive` are shown/hidden exclusively
|
|
36
|
-
it("supports exclusive layers", () => exclusiveLayers());
|
|
37
|
-
|
|
38
|
-
// Test if groups with no layers are shown as not expandable
|
|
39
|
-
it("shows groups with no layers as not expandable", () => emptyGroup());
|
|
40
|
-
|
|
41
|
-
// Test to verify the rendering of optional layer selection
|
|
42
|
-
it("renders the optional layer selection", () => renderOptionalLayer());
|
|
43
|
-
|
|
44
|
-
// Test to confirm the disabling of drag functionality for a disabled layer
|
|
45
|
-
it("disables the drag handle of the disabled layer", () => disableDrag());
|
|
46
|
-
|
|
47
|
-
// Test to ensure the display of correct layer titles
|
|
48
|
-
it("shows the correct layer titles", () => showCorrectLayerTitle());
|
|
49
|
-
|
|
50
|
-
// Test to check if a section is pre-opened when the layerControlExpand property is present
|
|
51
|
-
it("pre-opens a section if layerControlExpand is present", () =>
|
|
52
|
-
checkPreOpenSection());
|
|
53
|
-
|
|
54
|
-
// Test to verify pre-opening of the layer tools section if layerControlToolsExpand is present
|
|
55
|
-
it("pre-opens layer tools section if layerControlToolsExpand is present", () =>
|
|
56
|
-
checkPreOpenLayerTools());
|
|
57
|
-
});
|
package/test/layersUpdate.cy.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import "../src/main";
|
|
2
|
-
import "./_mockMap";
|
|
3
|
-
import {
|
|
4
|
-
addExternalLayers,
|
|
5
|
-
addLayerFromOptional,
|
|
6
|
-
checkLayerIsPushedToRoot,
|
|
7
|
-
checkLayerPushedToGroup,
|
|
8
|
-
checkLayerRemovedFromGroup,
|
|
9
|
-
checkLayerRemovedFromRoot,
|
|
10
|
-
checkLayerSizeAfterMultipleCalls,
|
|
11
|
-
checkLayerZoomState,
|
|
12
|
-
checkLayerChangedEvent,
|
|
13
|
-
} from "./cases/layer-update";
|
|
14
|
-
|
|
15
|
-
describe("LayerControl", () => {
|
|
16
|
-
// Before each test case, set up the environment
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
// Extract test case titles to determine specific test conditions
|
|
19
|
-
const showLayerZoomState = Cypress.mocha
|
|
20
|
-
.getRunner()
|
|
21
|
-
.suite.ctx.currentTest.title.includes("showLayerZoomState");
|
|
22
|
-
|
|
23
|
-
const addExternalLayersTest = Cypress.mocha
|
|
24
|
-
.getRunner()
|
|
25
|
-
.suite.ctx.currentTest.title.includes("addExternalLayers");
|
|
26
|
-
|
|
27
|
-
// Mount the mock map and the LayerControl component
|
|
28
|
-
cy.mount("<mock-map></mock-map>").as("mock-map");
|
|
29
|
-
cy.mount(`<eox-layercontrol for="mock-map"></eox-layercontrol>`, {
|
|
30
|
-
properties: {
|
|
31
|
-
showLayerZoomState,
|
|
32
|
-
addExternalLayers: addExternalLayersTest,
|
|
33
|
-
},
|
|
34
|
-
}).as("eox-layercontrol");
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Test case: Check if the correct number of layers is displayed after multiple setMap() calls
|
|
38
|
-
it("displays the correct amount of layers after multiple calls of setMap()", () =>
|
|
39
|
-
checkLayerSizeAfterMultipleCalls());
|
|
40
|
-
|
|
41
|
-
// Test case: Check if a layer update occurs when pushed to the root collection
|
|
42
|
-
it("updates if a layer is pushed to the root collection", () =>
|
|
43
|
-
checkLayerIsPushedToRoot());
|
|
44
|
-
|
|
45
|
-
// Test case: Check if a layer update occurs when pushed to a group
|
|
46
|
-
it("updates if a layer is pushed to a group", () =>
|
|
47
|
-
checkLayerPushedToGroup());
|
|
48
|
-
|
|
49
|
-
// Test case: Check if a layer update occurs when removed from the root collection
|
|
50
|
-
it("updates if a layer is removed from the root collection", () =>
|
|
51
|
-
checkLayerRemovedFromRoot());
|
|
52
|
-
|
|
53
|
-
// Test case: Check if a layer update occurs when removed from a group
|
|
54
|
-
it("updates if a layer is removed from a group", () =>
|
|
55
|
-
checkLayerRemovedFromGroup());
|
|
56
|
-
|
|
57
|
-
// Test case: Check if a layer is correctly added to a group when originally optional
|
|
58
|
-
it("adds a layer to a correct group when originally optional", () =>
|
|
59
|
-
addLayerFromOptional());
|
|
60
|
-
|
|
61
|
-
// Test case: Check layer state based on min and max zoom levels when showLayerZoomState is enabled
|
|
62
|
-
it("Zoom and check layer state based on min and max zoom - showLayerZoomState", () =>
|
|
63
|
-
checkLayerZoomState());
|
|
64
|
-
|
|
65
|
-
// Test case: Add new external layers (WMS/XYZ and JSON)
|
|
66
|
-
it("Add new external WMS/XYZ and JSON Layer - addExternalLayers", () =>
|
|
67
|
-
addExternalLayers());
|
|
68
|
-
|
|
69
|
-
// Test case: `layerchange` event
|
|
70
|
-
it("Checks if a `layerchange` event is dispatched", () =>
|
|
71
|
-
checkLayerChangedEvent());
|
|
72
|
-
});
|