@eox/itemfilter 0.9.0 → 0.10.1
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/dist/eox-itemfilter.js +4453 -3015
- package/dist/eox-itemfilter.umd.cjs +476 -209
- package/package.json +4 -3
- package/test/_mockMap.js +20 -0
- package/test/general.cy.ts +43 -6
- package/test/state.cy.ts +5 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"lint:fix": "eslint --ext .js,.ts . --fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@floating-ui/dom": "^1.5.3",
|
|
31
32
|
"@turf/boolean-intersects": "^6.5.0",
|
|
32
33
|
"@turf/boolean-within": "^6.5.0",
|
|
33
|
-
"fuse.js": "^
|
|
34
|
-
"lit": "^
|
|
34
|
+
"fuse.js": "^7.0.0",
|
|
35
|
+
"lit": "^3.0.2",
|
|
35
36
|
"lodash.debounce": "^4.0.8",
|
|
36
37
|
"toolcool-range-slider": "^4.0.27"
|
|
37
38
|
}
|
package/test/_mockMap.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class MockMap extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
this.attachShadow({ mode: "open" });
|
|
5
|
+
const canvas = document.createElement("canvas");
|
|
6
|
+
this.shadowRoot.appendChild(canvas);
|
|
7
|
+
}
|
|
8
|
+
addDraw() {}
|
|
9
|
+
interactions = {
|
|
10
|
+
drawInteraction: {
|
|
11
|
+
on: () => {},
|
|
12
|
+
},
|
|
13
|
+
drawInteraction_modify: {
|
|
14
|
+
on: () => {},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
removeInteraction() {}
|
|
18
|
+
setLayers() {}
|
|
19
|
+
}
|
|
20
|
+
customElements.define("eox-map", MockMap);
|
package/test/general.cy.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../src/main";
|
|
2
|
+
import "./_mockMap";
|
|
2
3
|
import testItems from "./testItems.json";
|
|
3
4
|
|
|
4
5
|
describe("Item Filter Config", () => {
|
|
@@ -86,12 +87,16 @@ describe("Item Filter Config", () => {
|
|
|
86
87
|
cy.get("eox-itemfilter")
|
|
87
88
|
.shadow()
|
|
88
89
|
.within(() => {
|
|
89
|
-
cy.get(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
cy.get("eox-selectionlist")
|
|
91
|
+
.shadow()
|
|
92
|
+
.within(() => {
|
|
93
|
+
cy.get('[type="checkbox"]').first().check();
|
|
94
|
+
cy.get('[type="checkbox"]').eq(1).check();
|
|
95
|
+
cy.get('[type="checkbox"]').first().check();
|
|
96
|
+
cy.get('[type="checkbox"]').first().should("be.checked");
|
|
97
|
+
cy.get('[type="checkbox"]').eq(1).check();
|
|
98
|
+
cy.get('[type="checkbox"]').eq(1).should("be.checked");
|
|
99
|
+
});
|
|
95
100
|
});
|
|
96
101
|
});
|
|
97
102
|
|
|
@@ -188,4 +193,36 @@ describe("Item Filter Config", () => {
|
|
|
188
193
|
checkExclusiveOpen("ul#filters", true);
|
|
189
194
|
checkExclusiveOpen("ul#results");
|
|
190
195
|
});
|
|
196
|
+
|
|
197
|
+
it("should show the map when spatial filter is enabled", () => {
|
|
198
|
+
cy.get("eox-itemfilter").and(($el) => {
|
|
199
|
+
const eoxItemFilter = <EOxItemFilter>$el[0];
|
|
200
|
+
eoxItemFilter.config = {
|
|
201
|
+
titleProperty: "title",
|
|
202
|
+
filterProperties: [
|
|
203
|
+
{
|
|
204
|
+
key: "geometry",
|
|
205
|
+
type: "spatial",
|
|
206
|
+
expanded: true,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
eoxItemFilter.apply(testItems);
|
|
211
|
+
});
|
|
212
|
+
cy.get("eox-itemfilter")
|
|
213
|
+
.shadow()
|
|
214
|
+
.within(() => {
|
|
215
|
+
cy.get("eox-itemfilter-spatial")
|
|
216
|
+
.get("eox-itemfilter-spatial-filter")
|
|
217
|
+
.shadow()
|
|
218
|
+
.within(() => {
|
|
219
|
+
cy.get("eox-map").should("exist");
|
|
220
|
+
cy.get("eox-map")
|
|
221
|
+
.shadow()
|
|
222
|
+
.within(() => {
|
|
223
|
+
cy.get("canvas").should("exist");
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
191
228
|
});
|
package/test/state.cy.ts
CHANGED
|
@@ -34,10 +34,11 @@ describe("Item Filter Config", () => {
|
|
|
34
34
|
cy.get("eox-itemfilter")
|
|
35
35
|
.shadow()
|
|
36
36
|
.within(() => {
|
|
37
|
-
cy.get("
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
cy.get("eox-selectionlist")
|
|
38
|
+
.shadow()
|
|
39
|
+
.within(() => {
|
|
40
|
+
cy.get('[type="checkbox"]:checked').should("have.length", 2);
|
|
41
|
+
});
|
|
41
42
|
});
|
|
42
43
|
});
|
|
43
44
|
|