@eox/itemfilter 0.8.5 → 0.9.0-alpha.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 +4538 -3047
- package/dist/eox-itemfilter.umd.cjs +488 -202
- package/package.json +3 -3
- package/test/general.cy.ts +33 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
],
|
|
22
22
|
"main": "./dist/eox-itemfilter.js",
|
|
23
23
|
"scripts": {
|
|
24
|
-
"start": "vite",
|
|
25
24
|
"build": "tsc && vite build",
|
|
26
|
-
"watch": "
|
|
25
|
+
"watch": "vite build --watch",
|
|
27
26
|
"format": "prettier --write .",
|
|
28
27
|
"lint": "eslint --ext .js,.ts .",
|
|
29
28
|
"lint:fix": "eslint --ext .js,.ts . --fix"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
31
|
+
"@floating-ui/dom": "^1.5.3",
|
|
32
32
|
"@turf/boolean-intersects": "^6.5.0",
|
|
33
33
|
"@turf/boolean-within": "^6.5.0",
|
|
34
34
|
"fuse.js": "^6.6.2",
|
package/test/general.cy.ts
CHANGED
|
@@ -138,39 +138,51 @@ describe("Item Filter Config", () => {
|
|
|
138
138
|
// });
|
|
139
139
|
// });
|
|
140
140
|
|
|
141
|
-
it(
|
|
141
|
+
it("should allow only one accordion of each type to be open at a time if configured", () => {
|
|
142
142
|
cy.get("eox-itemfilter").then(($el) => {
|
|
143
143
|
(<EOxItemFilter>$el[0]).config.expandMultipleFilters = false;
|
|
144
144
|
(<EOxItemFilter>$el[0]).config.expandMultipleResults = false;
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
const checkExclusiveOpen = (selector: string, isSubcomponent = false) => {
|
|
148
|
-
cy.get("eox-itemfilter")
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
cy.get("eox-itemfilter")
|
|
149
|
+
.shadow()
|
|
150
|
+
.within(() => {
|
|
151
|
+
cy.get(selector).then((accordions) => {
|
|
152
|
+
for (let i = 0; i < accordions.length; i++) {
|
|
153
|
+
const accordionToClick = isSubcomponent
|
|
154
|
+
? cy
|
|
155
|
+
.get(selector)
|
|
156
|
+
.eq(i)
|
|
157
|
+
.find("eox-itemfilter-expandcontainer")
|
|
158
|
+
.shadow()
|
|
159
|
+
.find("details")
|
|
160
|
+
: cy.get(selector).eq(i).find("details");
|
|
154
161
|
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
accordionToClick.click({ multiple: true, force: true });
|
|
163
|
+
accordionToClick.should("have.attr", "open");
|
|
157
164
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
// Check that all other accordions are closed
|
|
166
|
+
for (let j = 0; j < accordions.length; j++) {
|
|
167
|
+
if (i !== j) {
|
|
168
|
+
const accordionToCheck = isSubcomponent
|
|
169
|
+
? cy
|
|
170
|
+
.get(selector)
|
|
171
|
+
.eq(j)
|
|
172
|
+
.find("eox-itemfilter-expandcontainer")
|
|
173
|
+
.shadow()
|
|
174
|
+
.find("details")
|
|
175
|
+
: cy.get(selector).eq(j).find("details");
|
|
164
176
|
|
|
165
|
-
|
|
177
|
+
accordionToCheck.should("not.have.attr", "open");
|
|
178
|
+
}
|
|
166
179
|
}
|
|
167
180
|
}
|
|
168
|
-
}
|
|
181
|
+
});
|
|
169
182
|
});
|
|
170
|
-
|
|
171
|
-
}
|
|
183
|
+
};
|
|
172
184
|
|
|
173
|
-
checkExclusiveOpen(
|
|
174
|
-
checkExclusiveOpen(
|
|
185
|
+
checkExclusiveOpen("ul#filters", true);
|
|
186
|
+
checkExclusiveOpen("ul#results");
|
|
175
187
|
});
|
|
176
188
|
});
|