@eox/itemfilter
Advanced tools
Comparing version 0.8.5 to 0.8.6
{ | ||
"name": "@eox/itemfilter", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"type": "module", | ||
@@ -25,3 +25,3 @@ "devDependencies": { | ||
"start": "vite", | ||
"build": "tsc && vite build", | ||
"build": "vite build", | ||
"watch": "tsc && vite build --watch", | ||
@@ -28,0 +28,0 @@ "format": "prettier --write .", |
@@ -141,3 +141,3 @@ import "../src/main"; | ||
it('should allow only one accordion of each type to be open at a time if configured', () => { | ||
it("should allow only one accordion of each type to be open at a time if configured", () => { | ||
cy.get("eox-itemfilter").then(($el) => { | ||
@@ -149,30 +149,42 @@ (<EOxItemFilter>$el[0]).config.expandMultipleFilters = false; | ||
const checkExclusiveOpen = (selector: string, isSubcomponent = false) => { | ||
cy.get("eox-itemfilter").shadow().within(() => { | ||
cy.get(selector).then(accordions => { | ||
for (let i = 0; i < accordions.length; i++) { | ||
const accordionToClick = isSubcomponent | ||
? cy.get(selector).eq(i).find('eox-itemfilter-expandcontainer').shadow().find('details') | ||
: cy.get(selector).eq(i).find('details'); | ||
cy.get("eox-itemfilter") | ||
.shadow() | ||
.within(() => { | ||
cy.get(selector).then((accordions) => { | ||
for (let i = 0; i < accordions.length; i++) { | ||
const accordionToClick = isSubcomponent | ||
? cy | ||
.get(selector) | ||
.eq(i) | ||
.find("eox-itemfilter-expandcontainer") | ||
.shadow() | ||
.find("details") | ||
: cy.get(selector).eq(i).find("details"); | ||
accordionToClick.click({ multiple: true, force: true }); | ||
accordionToClick.should('have.attr', 'open'); | ||
accordionToClick.click({ multiple: true, force: true }); | ||
accordionToClick.should("have.attr", "open"); | ||
// Check that all other accordions are closed | ||
for (let j = 0; j < accordions.length; j++) { | ||
if (i !== j) { | ||
const accordionToCheck = isSubcomponent | ||
? cy.get(selector).eq(j).find('eox-itemfilter-expandcontainer').shadow().find('details') | ||
: cy.get(selector).eq(j).find('details'); | ||
// Check that all other accordions are closed | ||
for (let j = 0; j < accordions.length; j++) { | ||
if (i !== j) { | ||
const accordionToCheck = isSubcomponent | ||
? cy | ||
.get(selector) | ||
.eq(j) | ||
.find("eox-itemfilter-expandcontainer") | ||
.shadow() | ||
.find("details") | ||
: cy.get(selector).eq(j).find("details"); | ||
accordionToCheck.should('not.have.attr', 'open'); | ||
accordionToCheck.should("not.have.attr", "open"); | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
checkExclusiveOpen('ul#filters', true); | ||
checkExclusiveOpen('ul#results'); | ||
checkExclusiveOpen("ul#filters", true); | ||
checkExclusiveOpen("ul#results"); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
343902
7538