@eox/layercontrol 0.17.4 → 0.17.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/layercontrol",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@eox/eslint-config": "^1.0.0",
@@ -0,0 +1,35 @@
1
+ // Function to simulate exclusive layers and groups within the LayerControl
2
+ const exclusiveLayers = () => {
3
+ // Set up the layers in the mock map
4
+ cy.get("mock-map").then(($el) => {
5
+ const mockMap = $el[0]; // Accessing the mock map element
6
+
7
+ // Setting layers and a group with layerControlExclusive
8
+ mockMap.setLayers([
9
+ { properties: { id: "a", layerControlExclusive: true }, visible: true },
10
+ { properties: { id: "b", layerControlExclusive: true }, visible: false },
11
+ {
12
+ type: "Group",
13
+ properties: {
14
+ id: "c",
15
+ layerControlExclusive: true,
16
+ layerControlExpand: true,
17
+ },
18
+ layers: [{ properties: { id: "d", visible: true } }],
19
+ visible: false,
20
+ },
21
+ ]);
22
+ });
23
+
24
+ // Verify the effect on the LayerControl
25
+ cy.get("eox-layercontrol")
26
+ .shadow()
27
+ .within(() => {
28
+ // Checking the number of checked radio inputs in the LayerControl
29
+ cy.get("ul").find("input[type=radio]:checked").should("have.length", 1);
30
+ cy.get("ul").find("input[type=radio]:not(:checked)").last().click();
31
+ cy.get("ul").find("input[type=radio]:checked").should("have.length", 1);
32
+ });
33
+ };
34
+
35
+ export default exclusiveLayers;
@@ -2,6 +2,7 @@ export { default as checkLayerSize } from "./check-layer-size";
2
2
  export { default as checkPreOpenLayerTools } from "./check-pre-open-layer-tools";
3
3
  export { default as checkPreOpenSection } from "./check-pre-open-section";
4
4
  export { default as disableDrag } from "./disable-drag";
5
+ export { default as exclusiveLayers } from "./exclusive-layers";
5
6
  export { default as hideLayers } from "./hide-layers";
6
7
  export { default as emptyGroup } from "./empty-groups";
7
8
  export { default as renderOptionalLayer } from "./render-optional-layer";
@@ -6,6 +6,7 @@ import {
6
6
  checkPreOpenLayerTools,
7
7
  checkPreOpenSection,
8
8
  disableDrag,
9
+ exclusiveLayers,
9
10
  hideLayers,
10
11
  emptyGroup,
11
12
  renderOptionalLayer,
@@ -31,6 +32,9 @@ describe("LayerControl", () => {
31
32
  // Test to validate the hiding of layers
32
33
  it("hides layers correctly", () => hideLayers());
33
34
 
35
+ // Test to verify that layers with `layerContorlExclusive` are shown/hidden exclusively
36
+ it("supports exclusive layers", () => exclusiveLayers());
37
+
34
38
  // Test if groups with no layers are shown as not expandable
35
39
  it("shows groups with no layers as not expandable", () => emptyGroup());
36
40