@eox/itemfilter 0.6.3 → 0.8.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/dist/eox-itemfilter.js +3546 -3297
- package/dist/eox-itemfilter.umd.cjs +362 -222
- package/package.json +2 -1
- package/test/general.cy.ts +131 -50
- package/test/testItems.json +1 -12
- package/test/config.cy.ts +0 -161
- package/test/general.html +0 -28
- package/test/inlineMode.cy.ts +0 -24
- package/test/reducedWidth.cy.ts +0 -33
- package/test/styledResults.cy.ts +0 -21
- package/test/styledResults.html +0 -45
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
7
|
+
"@types/lodash.debounce": "^4.0.7",
|
|
7
8
|
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
8
9
|
"@typescript-eslint/parser": "^5.50.0",
|
|
9
10
|
"eslint-plugin-typescript": "^0.14.0",
|
package/test/general.cy.ts
CHANGED
|
@@ -1,59 +1,140 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../src/main";
|
|
2
2
|
import testItems from "./testItems.json";
|
|
3
3
|
|
|
4
|
-
describe("Item Filter", () => {
|
|
4
|
+
describe("Item Filter Config", () => {
|
|
5
5
|
beforeEach(() => {
|
|
6
|
-
cy.
|
|
6
|
+
cy.mount(
|
|
7
|
+
`<eox-itemfilter>
|
|
8
|
+
<h4 slot="filterstitle">Filter</h4>
|
|
9
|
+
<h4 slot="resultstitle">Results</h4>
|
|
10
|
+
</eox-itemfilter>`
|
|
11
|
+
)
|
|
12
|
+
.as("eox-itemfilter")
|
|
13
|
+
.then((eoxItemFilter: any) => {
|
|
14
|
+
eoxItemFilter[0].config = {
|
|
15
|
+
titleProperty: "title",
|
|
16
|
+
filterProperties: [
|
|
17
|
+
{
|
|
18
|
+
keys: ["title", "themes"],
|
|
19
|
+
title: "Search",
|
|
20
|
+
type: "text",
|
|
21
|
+
expanded: true,
|
|
22
|
+
},
|
|
23
|
+
{ key: "themes", expanded: true },
|
|
24
|
+
],
|
|
25
|
+
aggregateResults: "themes",
|
|
26
|
+
enableHighlighting: true,
|
|
27
|
+
};
|
|
28
|
+
eoxItemFilter[0].apply(testItems);
|
|
29
|
+
});
|
|
7
30
|
});
|
|
8
31
|
|
|
9
|
-
it("
|
|
32
|
+
it("should have a search bar", () => {
|
|
33
|
+
cy.get("eox-itemfilter")
|
|
34
|
+
.shadow()
|
|
35
|
+
.within(() => {
|
|
36
|
+
cy.get("[data-cy='search']").should("exist");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should filter results based on search string", () => {
|
|
41
|
+
cy.get("eox-itemfilter")
|
|
42
|
+
.shadow()
|
|
43
|
+
.within(() => {
|
|
44
|
+
cy.get("[data-cy='search']").type("white");
|
|
45
|
+
cy.get("ul#results").children();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("should highlight results", () => {
|
|
50
|
+
cy.get("eox-itemfilter")
|
|
51
|
+
.shadow()
|
|
52
|
+
.within(() => {
|
|
53
|
+
cy.get("[data-cy='search']").type("white");
|
|
54
|
+
cy.get("mark.highlight").contains("White");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("should disable highlight", () => {
|
|
10
59
|
cy.get("eox-itemfilter").should(($el) => {
|
|
11
|
-
|
|
12
|
-
EOxItemFilter.config = {
|
|
13
|
-
titleProperty: "title",
|
|
14
|
-
filterProperties: [
|
|
15
|
-
{ key: "themes", title: "Theme", exclusive: true },
|
|
16
|
-
// { key: "code" },
|
|
17
|
-
// { key: "likes", type: "range" },
|
|
18
|
-
// { key: "year", type: "range" },
|
|
19
|
-
// { key: "years", type: "range" },
|
|
20
|
-
{ key: "years", type: "range" },
|
|
21
|
-
{ key: "datetime", type: "range", format: "date" },
|
|
22
|
-
{ key: "bbox", type: "spatial" },
|
|
23
|
-
],
|
|
24
|
-
aggregateResults: "themes",
|
|
25
|
-
enableSearch: true,
|
|
26
|
-
enableHighlighting: true,
|
|
27
|
-
// showResults: false,
|
|
28
|
-
fuseConfig: {
|
|
29
|
-
// keys: ["title", "description", "themes", "code", "datetime"],
|
|
30
|
-
keys: ["title", "datetime"],
|
|
31
|
-
},
|
|
32
|
-
// onSelect: (item: any) => {
|
|
33
|
-
// console.log(item);
|
|
34
|
-
// },
|
|
35
|
-
// matchAllWhenEmpty: true,
|
|
36
|
-
// exclusiveFilters: true,
|
|
37
|
-
// externalSearch: (input, filters) => {
|
|
38
|
-
// const base =
|
|
39
|
-
// "https://resource-catalogue.testing.opensciencedata.esa.int/collections/metadata:main/items?type=collection&f=json";
|
|
40
|
-
// if (filters) {
|
|
41
|
-
// let filterString = "";
|
|
42
|
-
// Object.keys(filters).forEach((filter) =>
|
|
43
|
-
// Object.entries(filters[filter]).forEach(([key, value]) => {
|
|
44
|
-
// if (value) {
|
|
45
|
-
// filterString += `${filter.replace("s", "")}:${key}`;
|
|
46
|
-
// }
|
|
47
|
-
// })
|
|
48
|
-
// );
|
|
49
|
-
// console.log(filterString);
|
|
50
|
-
// return `${base}&q=${input}&filter=keywords%20ILIKE%20%27%${filterString}%%27`;
|
|
51
|
-
// } else {
|
|
52
|
-
// return `${base}&q=${input}`;
|
|
53
|
-
// }
|
|
54
|
-
// },
|
|
55
|
-
};
|
|
56
|
-
EOxItemFilter.apply(testItems);
|
|
60
|
+
(<EOxItemFilter>$el[0]).config.enableHighlighting = false;
|
|
57
61
|
});
|
|
62
|
+
cy.get("eox-itemfilter")
|
|
63
|
+
.shadow()
|
|
64
|
+
.within(() => {
|
|
65
|
+
cy.get("[data-cy='search']").type("white");
|
|
66
|
+
cy.get("mark.highlight").should("not.exist");
|
|
67
|
+
});
|
|
58
68
|
});
|
|
69
|
+
|
|
70
|
+
// it("should not have a search bar", () => {
|
|
71
|
+
// cy.get("eox-itemfilter").should(($el) => {
|
|
72
|
+
// (<EOxItemFilter>$el[0]).config = {
|
|
73
|
+
// titleProperty: "title",
|
|
74
|
+
// filterProperties: [{ key: "themes", type: "multiselect", title: "foobar" }],
|
|
75
|
+
// };
|
|
76
|
+
// EOxItemFilter.apply(testItems);
|
|
77
|
+
// });
|
|
78
|
+
// cy.get("eox-itemfilter")
|
|
79
|
+
// .shadow()
|
|
80
|
+
// .find("input[type='text']")
|
|
81
|
+
// .should("not.exist");
|
|
82
|
+
// });
|
|
83
|
+
|
|
84
|
+
it("should allow multiple filters", () => {
|
|
85
|
+
cy.get("eox-itemfilter")
|
|
86
|
+
.shadow()
|
|
87
|
+
.within(() => {
|
|
88
|
+
cy.get('[type="checkbox"]').first().check();
|
|
89
|
+
cy.get('[type="checkbox"]').eq(1).check();
|
|
90
|
+
cy.get('[type="checkbox"]').first().check().should("be.checked");
|
|
91
|
+
cy.get('[type="checkbox"]').eq(1).check().should("be.checked");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// it("should allow only one filter", () => {
|
|
96
|
+
// cy.get("eox-itemfilter").should(($el) => {
|
|
97
|
+
// const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
98
|
+
// // have to replace the entire config, otherwise exclusiveFilters = true doesn't work
|
|
99
|
+
// EOxItemFilter.config = {
|
|
100
|
+
// titleProperty: "title",
|
|
101
|
+
// filterProperties: [{ key: "themes", exclusive: true }],
|
|
102
|
+
// aggregateResults: "themes",
|
|
103
|
+
// enableHighlighting: true,
|
|
104
|
+
// };
|
|
105
|
+
// EOxItemFilter.apply(testItems);
|
|
106
|
+
// });
|
|
107
|
+
// cy.get("eox-itemfilter")
|
|
108
|
+
// .shadow()
|
|
109
|
+
// .within(() => {
|
|
110
|
+
// cy.get(".details-filter").click();
|
|
111
|
+
// cy.get('[type="radio"]').first().check();
|
|
112
|
+
// cy.get('[type="radio"]').eq(1).check();
|
|
113
|
+
// cy.get('[type="radio"]').first().should("not.be.checked");
|
|
114
|
+
// });
|
|
115
|
+
// });
|
|
116
|
+
|
|
117
|
+
// it("should clear all filters", () => {
|
|
118
|
+
// cy.get("eox-itemfilter")
|
|
119
|
+
// .shadow()
|
|
120
|
+
// .within(() => {
|
|
121
|
+
// cy.get("[data-cy='search']").type("city");
|
|
122
|
+
// cy.get(".details-filter").click()
|
|
123
|
+
// .find('[type="checkbox"]')
|
|
124
|
+
// .then(($value) => {
|
|
125
|
+
// [...Array($value.length)].map((_, i) => {
|
|
126
|
+
// cy.get('[type="checkbox"]').eq(i).check();
|
|
127
|
+
// });
|
|
128
|
+
// });
|
|
129
|
+
// cy.get("[data-cy='filter-reset']").click();
|
|
130
|
+
// cy.get("[data-cy='search']").should("have.value", "");
|
|
131
|
+
// cy.get(".details-filter")
|
|
132
|
+
// .find('[type="checkbox"]')
|
|
133
|
+
// .then(($value) => {
|
|
134
|
+
// [...Array($value.length)].map((_, i) => {
|
|
135
|
+
// cy.get('[type="checkbox"]').eq(i).should("not.be.checked");
|
|
136
|
+
// });
|
|
137
|
+
// });
|
|
138
|
+
// });
|
|
139
|
+
// });
|
|
59
140
|
});
|
package/test/testItems.json
CHANGED
|
@@ -89,18 +89,7 @@
|
|
|
89
89
|
"likes": 177,
|
|
90
90
|
"years": [2021, 2022],
|
|
91
91
|
"timestamp": "2023-06-11T13:56:38+00:00",
|
|
92
|
-
"datetime": ["2023-06-11T10:56:38+00:00", "2023-06-11T22:56:38+00:00"]
|
|
93
|
-
"geometry": {
|
|
94
|
-
"type": "Polygon",
|
|
95
|
-
"coordinates": [
|
|
96
|
-
[
|
|
97
|
-
[-180.0, 90.0],
|
|
98
|
-
[-180.0, -90.0],
|
|
99
|
-
[180.0, -90.0],
|
|
100
|
-
[180.0, 90.0]
|
|
101
|
-
]
|
|
102
|
-
]
|
|
103
|
-
}
|
|
92
|
+
"datetime": ["2023-06-11T10:56:38+00:00", "2023-06-11T22:56:38+00:00"]
|
|
104
93
|
},
|
|
105
94
|
{
|
|
106
95
|
"archived": false,
|
package/test/config.cy.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { EOxItemFilter } from "../src/main";
|
|
2
|
-
import testItems from "./testItems.json";
|
|
3
|
-
|
|
4
|
-
describe("Item Filter Config", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
cy.visit("/elements/itemfilter/test/general.html");
|
|
7
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
8
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
9
|
-
// default config
|
|
10
|
-
EOxItemFilter.config = {
|
|
11
|
-
titleProperty: "title",
|
|
12
|
-
filterProperties: [{ key: "themes" }],
|
|
13
|
-
aggregateResults: "themes",
|
|
14
|
-
enableSearch: true,
|
|
15
|
-
enableHighlighting: true,
|
|
16
|
-
fuseConfig: {
|
|
17
|
-
keys: ["title", "description", "themes"],
|
|
18
|
-
},
|
|
19
|
-
// onSelect: (item: any) => {
|
|
20
|
-
// console.log(item);
|
|
21
|
-
// },
|
|
22
|
-
// matchAllWhenEmpty: true,
|
|
23
|
-
// exclusiveFilters: true,
|
|
24
|
-
};
|
|
25
|
-
EOxItemFilter.apply(testItems);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("should have a search bar", () => {
|
|
30
|
-
cy.get("eox-itemfilter")
|
|
31
|
-
.shadow()
|
|
32
|
-
.find("input")
|
|
33
|
-
.should("not.have.css", "display", "none");
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("should filter results based on search string", () => {
|
|
37
|
-
cy.get("eox-itemfilter")
|
|
38
|
-
.shadow()
|
|
39
|
-
.within(() => {
|
|
40
|
-
cy.get("[data-cy='search']").type("white");
|
|
41
|
-
cy.get("ul#results").children();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("should highlight results", () => {
|
|
46
|
-
cy.get("eox-itemfilter")
|
|
47
|
-
.shadow()
|
|
48
|
-
.within(() => {
|
|
49
|
-
cy.get("[data-cy='search']").type("white");
|
|
50
|
-
cy.get("mark.highlight").contains("White");
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("should disable highlight", () => {
|
|
55
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
56
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
57
|
-
EOxItemFilter.config.enableHighlighting = false;
|
|
58
|
-
});
|
|
59
|
-
cy.get("eox-itemfilter")
|
|
60
|
-
.shadow()
|
|
61
|
-
.within(() => {
|
|
62
|
-
cy.get("[data-cy='search']").type("white");
|
|
63
|
-
cy.get("mark.highlight").should("not.exist");
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("should not have a search bar", () => {
|
|
68
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
69
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
70
|
-
// have to replace the entire config, otherwise enableSearch = false doesn't work
|
|
71
|
-
EOxItemFilter.config = {
|
|
72
|
-
titleProperty: "title",
|
|
73
|
-
filterProperties: [{ key: "themes" }],
|
|
74
|
-
aggregateResults: "themes",
|
|
75
|
-
enableSearch: false,
|
|
76
|
-
enableHighlighting: true,
|
|
77
|
-
fuseConfig: {
|
|
78
|
-
keys: ["title", "description", "themes"],
|
|
79
|
-
},
|
|
80
|
-
// onSelect: (item: any) => {
|
|
81
|
-
// console.log(item);
|
|
82
|
-
// },
|
|
83
|
-
// matchAllWhenEmpty: true,
|
|
84
|
-
// exclusiveFilters: true,
|
|
85
|
-
};
|
|
86
|
-
EOxItemFilter.apply(testItems);
|
|
87
|
-
});
|
|
88
|
-
cy.get("eox-itemfilter")
|
|
89
|
-
.shadow()
|
|
90
|
-
.find("input[type='text']")
|
|
91
|
-
.should("not.exist");
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("should allow multiple filters", () => {
|
|
95
|
-
cy.get("eox-itemfilter")
|
|
96
|
-
.shadow()
|
|
97
|
-
.within(() => {
|
|
98
|
-
cy.get("[data-cy='expand-button']").click();
|
|
99
|
-
cy.get('[type="checkbox"]').first().check();
|
|
100
|
-
cy.get('[type="checkbox"]').eq(1).check();
|
|
101
|
-
cy.get('[type="checkbox"]').first().check().should("be.checked");
|
|
102
|
-
cy.get('[type="checkbox"]').eq(1).check().should("be.checked");
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("should allow only one filter", () => {
|
|
107
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
108
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
109
|
-
// have to replace the entire config, otherwise exclusiveFilters = true doesn't work
|
|
110
|
-
EOxItemFilter.config = {
|
|
111
|
-
titleProperty: "title",
|
|
112
|
-
filterProperties: [{ key: "themes" }],
|
|
113
|
-
aggregateResults: "themes",
|
|
114
|
-
enableSearch: false,
|
|
115
|
-
enableHighlighting: true,
|
|
116
|
-
fuseConfig: {
|
|
117
|
-
keys: ["title", "description", "themes"],
|
|
118
|
-
},
|
|
119
|
-
// onSelect: (item: any) => {
|
|
120
|
-
// console.log(item);
|
|
121
|
-
// },
|
|
122
|
-
// matchAllWhenEmpty: true,
|
|
123
|
-
exclusiveFilters: true,
|
|
124
|
-
};
|
|
125
|
-
EOxItemFilter.apply(testItems);
|
|
126
|
-
});
|
|
127
|
-
cy.get("eox-itemfilter")
|
|
128
|
-
.shadow()
|
|
129
|
-
.within(() => {
|
|
130
|
-
cy.get("[data-cy='expand-button']").click();
|
|
131
|
-
cy.get('[type="radio"]').first().check();
|
|
132
|
-
cy.get('[type="radio"]').eq(1).check();
|
|
133
|
-
cy.get('[type="radio"]').first().should("not.be.checked");
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("should clear all filters", () => {
|
|
138
|
-
cy.get("eox-itemfilter")
|
|
139
|
-
.shadow()
|
|
140
|
-
.within(() => {
|
|
141
|
-
cy.get("[data-cy='search']").type("city");
|
|
142
|
-
cy.get("[data-cy='expand-button']").click();
|
|
143
|
-
cy.get("#details-filter")
|
|
144
|
-
.find('[type="checkbox"]')
|
|
145
|
-
.then(($value) => {
|
|
146
|
-
[...Array($value.length)].map((_, i) => {
|
|
147
|
-
cy.get('[type="checkbox"]').eq(i).check();
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
cy.get("[data-cy='filter-reset']").click();
|
|
151
|
-
cy.get("[data-cy='search']").should("have.value", "");
|
|
152
|
-
cy.get("#details-filter")
|
|
153
|
-
.find('[type="checkbox"]')
|
|
154
|
-
.then(($value) => {
|
|
155
|
-
[...Array($value.length)].map((_, i) => {
|
|
156
|
-
cy.get('[type="checkbox"]').eq(i).should("not.be.checked");
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
package/test/general.html
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<style>
|
|
5
|
-
html,
|
|
6
|
-
body,
|
|
7
|
-
eox-itemfilter {
|
|
8
|
-
padding: 0;
|
|
9
|
-
margin: 0;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
}
|
|
13
|
-
</style>
|
|
14
|
-
<script type="module" defer src="../dist/eox-itemfilter.js"></script>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<eox-itemfilter>
|
|
18
|
-
<h4 slot="filterstitle">Filter</h4>
|
|
19
|
-
<h4 slot="resultstitle">Results</h4>
|
|
20
|
-
<!--<template data-type="result">
|
|
21
|
-
<div>
|
|
22
|
-
The new title: <strong>{{result.title}}</strong> -
|
|
23
|
-
<small>{{result.id}}</small>
|
|
24
|
-
</div>
|
|
25
|
-
</template>-->
|
|
26
|
-
</eox-itemfilter>
|
|
27
|
-
</body>
|
|
28
|
-
</html>
|
package/test/inlineMode.cy.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EOxItemFilter } from "../src/main";
|
|
2
|
-
import testItems from "./testItems.json";
|
|
3
|
-
|
|
4
|
-
describe("Item Filter", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
cy.visit("/elements/itemfilter/test/general.html");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("loads the itemfilter", () => {
|
|
10
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
11
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
12
|
-
EOxItemFilter.style.height = "100px";
|
|
13
|
-
EOxItemFilter.style.border = "1px solid grey";
|
|
14
|
-
EOxItemFilter.config = {
|
|
15
|
-
titleProperty: "title",
|
|
16
|
-
filterProperties: [{ key: "themes" }, { key: "code" }],
|
|
17
|
-
enableSearch: true,
|
|
18
|
-
showResults: false,
|
|
19
|
-
inlineMode: true,
|
|
20
|
-
};
|
|
21
|
-
EOxItemFilter.apply(testItems);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
package/test/reducedWidth.cy.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { EOxItemFilter } from "../src/main";
|
|
2
|
-
import testItems from "./testItems.json";
|
|
3
|
-
|
|
4
|
-
describe("Item Filter", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
cy.visit("/elements/itemfilter/test/general.html");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("loads the itemfilter", () => {
|
|
10
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
11
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
12
|
-
EOxItemFilter.config = {
|
|
13
|
-
titleProperty: "title",
|
|
14
|
-
filterProperties: [{ key: "themes" }],
|
|
15
|
-
aggregateResults: "themes",
|
|
16
|
-
enableSearch: true,
|
|
17
|
-
};
|
|
18
|
-
EOxItemFilter.apply(testItems);
|
|
19
|
-
});
|
|
20
|
-
cy.viewport(800, 700);
|
|
21
|
-
cy.wait(2000);
|
|
22
|
-
cy.viewport(600, 700);
|
|
23
|
-
cy.wait(2000);
|
|
24
|
-
cy.viewport(400, 700);
|
|
25
|
-
cy.wait(2000);
|
|
26
|
-
cy.viewport(800, 400);
|
|
27
|
-
cy.wait(2000);
|
|
28
|
-
cy.viewport(600, 400);
|
|
29
|
-
cy.wait(2000);
|
|
30
|
-
cy.viewport(400, 400);
|
|
31
|
-
cy.wait(2000);
|
|
32
|
-
});
|
|
33
|
-
});
|
package/test/styledResults.cy.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { EOxItemFilter } from "../src/main";
|
|
2
|
-
import testItems from "./testItems.json";
|
|
3
|
-
|
|
4
|
-
describe("Item Filter", () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
cy.visit("/elements/itemfilter/test/styledResults.html");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("loads the itemfilter", () => {
|
|
10
|
-
cy.get("eox-itemfilter").should(($el) => {
|
|
11
|
-
const EOxItemFilter = <EOxItemFilter>$el[0];
|
|
12
|
-
EOxItemFilter.config = {
|
|
13
|
-
titleProperty: "title",
|
|
14
|
-
filterProperties: [{ key: "themes" }, { key: "code" }],
|
|
15
|
-
enableSearch: true,
|
|
16
|
-
inlineMode: true,
|
|
17
|
-
};
|
|
18
|
-
EOxItemFilter.apply(testItems);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
});
|
package/test/styledResults.html
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<style>
|
|
5
|
-
html,
|
|
6
|
-
body,
|
|
7
|
-
eox-itemfilter {
|
|
8
|
-
padding: 0;
|
|
9
|
-
margin: 0;
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
}
|
|
13
|
-
eox-itemfilter::part(results) {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-wrap: wrap;
|
|
16
|
-
margin: -12px;
|
|
17
|
-
}
|
|
18
|
-
eox-itemfilter::part(result) {
|
|
19
|
-
border: thin solid #0003;
|
|
20
|
-
border-radius: 4px;
|
|
21
|
-
padding: 16px;
|
|
22
|
-
margin: 12px;
|
|
23
|
-
font-size: 0.875rem;
|
|
24
|
-
font-weight: 500;
|
|
25
|
-
letter-spacing: 0.007;
|
|
26
|
-
line-height: 1.375rem;
|
|
27
|
-
font-family: sans-serif;
|
|
28
|
-
}
|
|
29
|
-
eox-itemfilter::part(result)::before {
|
|
30
|
-
display: block;
|
|
31
|
-
content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>earth</title><path d="M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg>');
|
|
32
|
-
width: 20px;
|
|
33
|
-
height: 20px;
|
|
34
|
-
margin-bottom: 10px;
|
|
35
|
-
}
|
|
36
|
-
</style>
|
|
37
|
-
<script type="module" defer src="../dist/eox-itemfilter.js"></script>
|
|
38
|
-
</head>
|
|
39
|
-
<body>
|
|
40
|
-
<eox-itemfilter>
|
|
41
|
-
<h4 slot="filterstitle">Filter</h4>
|
|
42
|
-
<h4 slot="resultstitle">Results</h4>
|
|
43
|
-
</eox-itemfilter>
|
|
44
|
-
</body>
|
|
45
|
-
</html>
|