@eox/itemfilter 0.14.1 → 0.14.2-dev.1721300053.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.
@@ -23,6 +23,10 @@
23
23
  [-90.0, 82.0]
24
24
  ]
25
25
  ]
26
+ },
27
+ "tags": ["agriculture", "Sentinel-2", "asparagus"],
28
+ "status": {
29
+ "code": "active"
26
30
  }
27
31
  },
28
32
  {
@@ -49,6 +53,10 @@
49
53
  [0, 10]
50
54
  ]
51
55
  ]
56
+ },
57
+ "tags": ["agriculture", "workers", "availability"],
58
+ "status": {
59
+ "code": "inactive"
52
60
  }
53
61
  },
54
62
  {
@@ -75,6 +83,10 @@
75
83
  [-180.0, -61.0]
76
84
  ]
77
85
  ]
86
+ },
87
+ "tags": ["air quality", "sea ice", "freeboard"],
88
+ "status": {
89
+ "code": "active"
78
90
  }
79
91
  },
80
92
  {
@@ -89,7 +101,11 @@
89
101
  "likes": 177,
90
102
  "years": [2021, 2022],
91
103
  "timestamp": "2023-06-11T13:56:38+00:00",
92
- "datetime": ["2023-06-11T10:56:38+00:00", "2023-06-11T22:56:38+00:00"]
104
+ "datetime": ["2023-06-11T10:56:38+00:00", "2023-06-11T22:56:38+00:00"],
105
+ "tags": ["economy", "vessel density", "average"],
106
+ "status": {
107
+ "code": "inactive"
108
+ }
93
109
  },
94
110
  {
95
111
  "archived": false,
@@ -103,7 +119,11 @@
103
119
  "likes": 0,
104
120
  "years": [2005, 2016],
105
121
  "timestamp": "2023-06-10T13:56:38+00:00",
106
- "datetime": ["2023-06-10T10:56:38+00:00", "2023-06-10T22:56:38+00:00"]
122
+ "datetime": ["2023-06-10T10:56:38+00:00", "2023-06-10T22:56:38+00:00"],
123
+ "tags": ["economy", "vessel density", "cargo"],
124
+ "status": {
125
+ "code": "active"
126
+ }
107
127
  },
108
128
  {
109
129
  "archived": false,
@@ -117,7 +137,11 @@
117
137
  "likes": 0,
118
138
  "years": [2006, 2017],
119
139
  "timestamp": "2023-06-09T13:56:38+00:00",
120
- "datetime": ["2023-06-09T10:56:38+00:00", "2023-06-09T22:56:38+00:00"]
140
+ "datetime": ["2023-06-09T10:56:38+00:00", "2023-06-09T22:56:38+00:00"],
141
+ "tags": ["economy", "vessel density", "tanker"],
142
+ "status": {
143
+ "code": "inactive"
144
+ }
121
145
  },
122
146
  {
123
147
  "archived": false,
@@ -131,7 +155,11 @@
131
155
  "likes": 2,
132
156
  "years": [2001, 2003],
133
157
  "timestamp": "2023-06-08T13:56:38+00:00",
134
- "datetime": ["2023-06-08T10:56:38+00:00", "2023-06-08T22:56:38+00:00"]
158
+ "datetime": ["2023-06-08T10:56:38+00:00", "2023-06-08T22:56:38+00:00"],
159
+ "tags": ["economy", "vessel density", "others"],
160
+ "status": {
161
+ "code": "active"
162
+ }
135
163
  },
136
164
  {
137
165
  "archived": false,
@@ -146,7 +174,11 @@
146
174
  "likes": 65,
147
175
  "years": [2015, 2020],
148
176
  "timestamp": "2023-06-07T13:56:38+00:00",
149
- "datetime": ["2023-06-07T10:56:38+00:00", "2023-06-07T22:56:38+00:00"]
177
+ "datetime": ["2023-06-07T10:56:38+00:00", "2023-06-07T22:56:38+00:00"],
178
+ "tags": ["economy", "air", "NO2", "boat traffic"],
179
+ "status": {
180
+ "code": "inactive"
181
+ }
150
182
  },
151
183
  {
152
184
  "archived": false,
@@ -160,7 +192,11 @@
160
192
  "likes": 34,
161
193
  "years": [2021, 2021],
162
194
  "timestamp": "2023-06-06T13:56:38+00:00",
163
- "datetime": ["2023-06-06T10:56:38+00:00", "2023-06-06T22:56:38+00:00"]
195
+ "datetime": ["2023-06-06T10:56:38+00:00", "2023-06-06T22:56:38+00:00"],
196
+ "tags": ["air", "temperature", "C3S Data"],
197
+ "status": {
198
+ "code": "active"
199
+ }
164
200
  },
165
201
  {
166
202
  "archived": false,
@@ -174,7 +210,11 @@
174
210
  "likes": 88,
175
211
  "years": [2000, 2023],
176
212
  "timestamp": "2023-06-05T13:56:38+00:00",
177
- "datetime": ["2023-06-05T10:56:38+00:00", "2023-06-05T22:56:38+00:00"]
213
+ "datetime": ["2023-06-05T10:56:38+00:00", "2023-06-05T22:56:38+00:00"],
214
+ "tags": ["air", "PM2.5", "city level"],
215
+ "status": {
216
+ "code": "inactive"
217
+ }
178
218
  },
179
219
  {
180
220
  "archived": false,
@@ -188,7 +228,11 @@
188
228
  "likes": 77,
189
229
  "years": [2019, 2022],
190
230
  "timestamp": "2023-06-04T13:56:38+00:00",
191
- "datetime": ["2023-06-04T10:56:38+00:00", "2023-06-04T22:56:38+00:00"]
231
+ "datetime": ["2023-06-04T10:56:38+00:00", "2023-06-04T22:56:38+00:00"],
232
+ "tags": ["air", "NO2", "city level"],
233
+ "status": {
234
+ "code": "active"
235
+ }
192
236
  },
193
237
  {
194
238
  "archived": false,
@@ -202,7 +246,11 @@
202
246
  "likes": 23,
203
247
  "years": [2014, 2018],
204
248
  "timestamp": "2023-06-03T13:56:38+00:00",
205
- "datetime": ["2023-06-03T10:56:38+00:00", "2023-06-03T22:56:38+00:00"]
249
+ "datetime": ["2023-06-03T10:56:38+00:00", "2023-06-03T22:56:38+00:00"],
250
+ "tags": ["air", "PM10", "city level"],
251
+ "status": {
252
+ "code": "inactive"
253
+ }
206
254
  },
207
255
  {
208
256
  "archived": false,
@@ -216,7 +264,11 @@
216
264
  "likes": 56,
217
265
  "years": [2017, 2018],
218
266
  "timestamp": "2023-06-02T13:56:38+00:00",
219
- "datetime": ["2023-06-02T10:56:38+00:00", "2023-06-02T22:56:38+00:00"]
267
+ "datetime": ["2023-06-02T10:56:38+00:00", "2023-06-02T22:56:38+00:00"],
268
+ "tags": ["air", "O3", "city level"],
269
+ "status": {
270
+ "code": "active"
271
+ }
220
272
  },
221
273
  {
222
274
  "archived": false,
@@ -230,7 +282,11 @@
230
282
  "likes": 11,
231
283
  "years": [2018, 2019],
232
284
  "timestamp": "2023-06-01T13:56:38+00:00",
233
- "datetime": ["2023-06-01T10:56:38+00:00", "2023-06-01T22:56:38+00:00"]
285
+ "datetime": ["2023-06-01T10:56:38+00:00", "2023-06-01T22:56:38+00:00"],
286
+ "tags": ["economy", "cargo ships", "AIS data"],
287
+ "status": {
288
+ "code": "inactive"
289
+ }
234
290
  },
235
291
  {
236
292
  "archived": false,
@@ -244,7 +300,11 @@
244
300
  "likes": 8,
245
301
  "years": [2015, 2017],
246
302
  "timestamp": "2023-05-29T13:56:38+00:00",
247
- "datetime": ["2023-05-29T10:56:38+00:00", "2023-05-29T22:56:38+00:00"]
303
+ "datetime": ["2023-05-29T10:56:38+00:00", "2023-05-29T22:56:38+00:00"],
304
+ "tags": ["economy", "traffic", "mobile data"],
305
+ "status": {
306
+ "code": "active"
307
+ }
248
308
  },
249
309
  {
250
310
  "archived": false,
@@ -258,7 +318,11 @@
258
318
  "likes": 37,
259
319
  "years": [2014, 2015],
260
320
  "timestamp": "2023-05-28T13:56:38+00:00",
261
- "datetime": ["2023-05-28T10:56:38+00:00", "2023-05-28T22:56:38+00:00"]
321
+ "datetime": ["2023-05-28T10:56:38+00:00", "2023-05-28T22:56:38+00:00"],
322
+ "tags": ["water", "CHL-a", "concentration"],
323
+ "status": {
324
+ "code": "inactive"
325
+ }
262
326
  },
263
327
  {
264
328
  "archived": false,
@@ -272,7 +336,11 @@
272
336
  "likes": 4,
273
337
  "years": [2001, 2013],
274
338
  "timestamp": "2023-05-27T13:56:38+00:00",
275
- "datetime": ["2023-05-27T10:56:38+00:00", "2023-05-27T22:56:38+00:00"]
339
+ "datetime": ["2023-05-27T10:56:38+00:00", "2023-05-27T22:56:38+00:00"],
340
+ "tags": ["health", "Covid-19", "cases"],
341
+ "status": {
342
+ "code": "active"
343
+ }
276
344
  },
277
345
  {
278
346
  "archived": false,
@@ -286,7 +354,11 @@
286
354
  "likes": 39,
287
355
  "years": [2015, 2016],
288
356
  "timestamp": "2023-05-26T13:56:38+00:00",
289
- "datetime": ["2023-05-26T10:56:38+00:00", "2023-05-26T22:56:38+00:00"]
357
+ "datetime": ["2023-05-26T10:56:38+00:00", "2023-05-26T22:56:38+00:00"],
358
+ "tags": ["health", "Covid-19", "vaccinations"],
359
+ "status": {
360
+ "code": "inactive"
361
+ }
290
362
  },
291
363
  {
292
364
  "archived": false,
@@ -300,7 +372,11 @@
300
372
  "likes": 28,
301
373
  "years": [2014, 2020],
302
374
  "timestamp": "2023-05-25T13:56:38+00:00",
303
- "datetime": ["2023-05-25T10:56:38+00:00", "2023-05-25T22:56:38+00:00"]
375
+ "datetime": ["2023-05-25T10:56:38+00:00", "2023-05-25T22:56:38+00:00"],
376
+ "tags": ["economy", "crude oil", "input materials"],
377
+ "status": {
378
+ "code": "active"
379
+ }
304
380
  },
305
381
  {
306
382
  "archived": false,
@@ -314,6 +390,10 @@
314
390
  "likes": 17,
315
391
  "years": [1998, 1999],
316
392
  "timestamp": "2023-05-24T13:56:38+00:00",
317
- "datetime": ["2023-05-24T10:56:38+00:00", "2023-05-24T22:56:38+00:00"]
393
+ "datetime": ["2023-05-24T10:56:38+00:00", "2023-05-24T22:56:38+00:00"],
394
+ "tags": ["economy", "cruise ships", "AIS data"],
395
+ "status": {
396
+ "code": "inactive"
397
+ }
318
398
  }
319
399
  ]
@@ -1,230 +0,0 @@
1
- import "../src/main";
2
- import "./_mockMap";
3
- import testItems from "./testItems.json";
4
-
5
- describe("Item Filter Config", () => {
6
- beforeEach(() => {
7
- cy.mount(
8
- `<eox-itemfilter>
9
- <h4 slot="filterstitle">Filter</h4>
10
- <h4 slot="resultstitle">Results</h4>
11
- </eox-itemfilter>`
12
- )
13
- .as("eox-itemfilter")
14
- .then(($el) => {
15
- const eoxItemFilter = <EOxItemFilter>$el[0];
16
- Object.assign(eoxItemFilter, {
17
- config: {
18
- titleProperty: "title",
19
- filterProperties: [
20
- {
21
- keys: ["title", "themes"],
22
- title: "Search",
23
- type: "text",
24
- expanded: true,
25
- },
26
- { key: "themes", expanded: true },
27
- ],
28
- aggregateResults: "themes",
29
- enableHighlighting: true,
30
- },
31
- items: testItems,
32
- });
33
- });
34
- });
35
-
36
- it("should have a search bar", () => {
37
- cy.get("eox-itemfilter")
38
- .shadow()
39
- .within(() => {
40
- cy.get("[data-cy='search']").should("exist");
41
- });
42
- });
43
-
44
- it("should filter results based on search string", () => {
45
- cy.get("eox-itemfilter")
46
- .shadow()
47
- .within(() => {
48
- cy.get("[data-cy='search']").type("white");
49
- cy.get("ul#results").children();
50
- });
51
- });
52
-
53
- it("should highlight results", () => {
54
- cy.get("eox-itemfilter")
55
- .shadow()
56
- .within(() => {
57
- cy.get("[data-cy='search']").type("white");
58
- cy.get("mark.highlight").contains("White");
59
- });
60
- });
61
-
62
- it("should disable highlight", () => {
63
- cy.get("eox-itemfilter").should(($el) => {
64
- (<EOxItemFilter>$el[0]).config.enableHighlighting = false;
65
- });
66
- cy.get("eox-itemfilter")
67
- .shadow()
68
- .within(() => {
69
- cy.get("[data-cy='search']").type("white");
70
- cy.get("mark.highlight").should("not.exist");
71
- });
72
- });
73
-
74
- // it("should not have a search bar", () => {
75
- // cy.get("eox-itemfilter").should(($el) => {
76
- // (<EOxItemFilter>$el[0]).config = {
77
- // titleProperty: "title",
78
- // filterProperties: [{ key: "themes", type: "multiselect", title: "foobar" }],
79
- // };
80
- // EOxItemFilter.apply(testItems);
81
- // });
82
- // cy.get("eox-itemfilter")
83
- // .shadow()
84
- // .find("input[type='text']")
85
- // .should("not.exist");
86
- // });
87
-
88
- it("should allow multiple filters", () => {
89
- cy.get("eox-itemfilter")
90
- .shadow()
91
- .within(() => {
92
- cy.get("eox-selectionlist").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
- });
100
- });
101
- });
102
-
103
- // it("should allow only one filter", () => {
104
- // cy.get("eox-itemfilter").should(($el) => {
105
- // const EOxItemFilter = <EOxItemFilter>$el[0];
106
- // // have to replace the entire config, otherwise exclusiveFilters = true doesn't work
107
- // EOxItemFilter.config = {
108
- // titleProperty: "title",
109
- // filterProperties: [{ key: "themes", exclusive: true }],
110
- // aggregateResults: "themes",
111
- // enableHighlighting: true,
112
- // };
113
- // EOxItemFilter.apply(testItems);
114
- // });
115
- // cy.get("eox-itemfilter")
116
- // .shadow()
117
- // .within(() => {
118
- // cy.get(".details-filter").click();
119
- // cy.get('[type="radio"]').first().check();
120
- // cy.get('[type="radio"]').eq(1).check();
121
- // cy.get('[type="radio"]').first().should("not.be.checked");
122
- // });
123
- // });
124
-
125
- // it("should clear all filters", () => {
126
- // cy.get("eox-itemfilter")
127
- // .shadow()
128
- // .within(() => {
129
- // cy.get("[data-cy='search']").type("city");
130
- // cy.get(".details-filter").click()
131
- // .find('[type="checkbox"]')
132
- // .then(($value) => {
133
- // [...Array($value.length)].map((_, i) => {
134
- // cy.get('[type="checkbox"]').eq(i).check();
135
- // });
136
- // });
137
- // cy.get("[data-cy='filter-reset']").click();
138
- // cy.get("[data-cy='search']").should("have.value", "");
139
- // cy.get(".details-filter")
140
- // .find('[type="checkbox"]')
141
- // .then(($value) => {
142
- // [...Array($value.length)].map((_, i) => {
143
- // cy.get('[type="checkbox"]').eq(i).should("not.be.checked");
144
- // });
145
- // });
146
- // });
147
- // });
148
-
149
- it("should allow only one accordion of each type to be open at a time if configured", () => {
150
- cy.get("eox-itemfilter").then(($el) => {
151
- (<EOxItemFilter>$el[0]).config.expandMultipleFilters = false;
152
- (<EOxItemFilter>$el[0]).config.expandMultipleResults = false;
153
- });
154
-
155
- const checkExclusiveOpen = (selector: string, isSubcomponent = false) => {
156
- cy.get("eox-itemfilter")
157
- .shadow()
158
- .within(() => {
159
- cy.get(selector).then((accordions) => {
160
- for (let i = 0; i < accordions.length; i++) {
161
- const accordionToClick = isSubcomponent
162
- ? cy
163
- .get(selector)
164
- .eq(i)
165
- .find("eox-itemfilter-expandcontainer")
166
- .shadow()
167
- .find("details")
168
- : cy.get(selector).eq(i).find("details");
169
-
170
- accordionToClick.click({ multiple: true, force: true });
171
- accordionToClick.should("have.attr", "open");
172
-
173
- // Check that all other accordions are closed
174
- for (let j = 0; j < accordions.length; j++) {
175
- if (i !== j) {
176
- const accordionToCheck = isSubcomponent
177
- ? cy
178
- .get(selector)
179
- .eq(j)
180
- .find("eox-itemfilter-expandcontainer")
181
- .shadow()
182
- .find("details")
183
- : cy.get(selector).eq(j).find("details");
184
-
185
- accordionToCheck.should("not.have.attr", "open");
186
- }
187
- }
188
- }
189
- });
190
- });
191
- };
192
-
193
- checkExclusiveOpen("ul#filters", true);
194
- checkExclusiveOpen("ul#results");
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
- Object.assign(eoxItemFilter, {
201
- config: {
202
- titleProperty: "title",
203
- filterProperties: [
204
- {
205
- key: "geometry",
206
- type: "spatial",
207
- expanded: true,
208
- },
209
- ],
210
- },
211
- items: testItems,
212
- });
213
- });
214
- cy.get("eox-itemfilter")
215
- .shadow()
216
- .within(() => {
217
- cy.get("eox-itemfilter-spatial")
218
- .get("eox-itemfilter-spatial-filter")
219
- .shadow()
220
- .within(() => {
221
- cy.get("eox-map").should("exist");
222
- cy.get("eox-map")
223
- .shadow()
224
- .within(() => {
225
- cy.get("canvas").should("exist");
226
- });
227
- });
228
- });
229
- });
230
- });
package/test/state.cy.ts DELETED
@@ -1,100 +0,0 @@
1
- import "../src/main";
2
- import testItems from "./testItems.json";
3
-
4
- describe("Item Filter Config", () => {
5
- const state = {
6
- agriculture: true,
7
- health: true,
8
- };
9
- const customOrder = {
10
- health: 0,
11
- water: 1,
12
- air: 2,
13
- economy: 3,
14
- agriculture: 4,
15
- } as { [key: string]: number };
16
- const selectedResultIndex = 1;
17
- beforeEach(() => {
18
- cy.mount(`<eox-itemfilter></eox-itemfilter>`)
19
- .as("eox-itemfilter")
20
- .then(($el) => {
21
- const eoxItemFilter = <EOxItemFilter>$el[0];
22
- Object.assign(eoxItemFilter, {
23
- config: {
24
- titleProperty: "title",
25
- filterProperties: [
26
- {
27
- key: "themes",
28
- type: "multiselect",
29
- expanded: true,
30
- // @ts-ignore
31
- sort: (a, b) => customOrder[a] - customOrder[b],
32
- // @ts-ignore
33
- state,
34
- },
35
- ],
36
- aggregateResults: "themes",
37
- },
38
- items: testItems,
39
- selectedResult: testItems[selectedResultIndex],
40
- });
41
- });
42
- });
43
-
44
- it("should render the checkboxes as checked", () => {
45
- cy.get("eox-itemfilter")
46
- .shadow()
47
- .within(() => {
48
- cy.get("eox-selectionlist").within(() => {
49
- cy.get('[type="checkbox"]:checked').should("have.length", 2);
50
- });
51
- });
52
- });
53
-
54
- it("should only show the results of the pre-set filters", () => {
55
- cy.get("eox-itemfilter")
56
- .shadow()
57
- .within(() => {
58
- Object.keys(state).forEach((key) => {
59
- cy.get(".details-results > summary > .title").should(
60
- "contain.text",
61
- key
62
- );
63
- cy.get(".details-results > summary > .title").should(
64
- "contain.text",
65
- key
66
- );
67
- });
68
- cy.get(".details-results > summary > .title").should(
69
- "have.length",
70
- Object.keys(state).length
71
- );
72
- });
73
- });
74
-
75
- it("should render the pre-set result as checked", () => {
76
- cy.get("eox-itemfilter")
77
- .shadow()
78
- .within(() => {
79
- cy.get("input[data-cy=result-radio]")
80
- .eq(selectedResultIndex)
81
- .should("be.checked");
82
- cy.get("input[data-cy=result-radio][checked]").should("have.length", 1);
83
- });
84
- });
85
-
86
- it("should have a custom order", () => {
87
- cy.get("eox-itemfilter")
88
- .shadow()
89
- .within(() => {
90
- cy.get("eox-itemfilter-multiselect > eox-selectionlist").within(() => {
91
- Object.keys(customOrder).forEach((state) => {
92
- cy.get("ul [data-identifier]")
93
- .eq(customOrder[state])
94
- .invoke("attr", "data-identifier")
95
- .should("eq", state);
96
- });
97
- });
98
- });
99
- });
100
- });