New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(accordion): supports selection mode updates #6356
fix(accordion): supports selection mode updates #6356
Conversation
@@ -272,6 +271,7 @@ export class AccordionItem implements ConditionalSlotComponent { | |||
//-------------------------------------------------------------------------- | |||
|
|||
private determineActiveItem(): void { | |||
this.selectionMode = getElementProp(this.el, "selection-mode", "multiple"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking here, could this be set by the parent Accordion when selectionMode is updated @Watch("selectionMode") ...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think that can be used here considering we are determining the selection of items inside the accordion-item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🎉
expect(element).toEqualAttribute("selection-mode", "single"); | ||
element.setAttribute("selection-mode", "multiple"); | ||
await page.waitForChanges(); | ||
const item1 = await element.find("calcite-accordion-item[id='1']"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: const [item1, item2, item3] = await element.findAll("calcite-accordion-item");
. Totally up to you. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean 🧹 . applied this to other tests too.
Related Issue: #5143
Summary
This PR will allow user to switch
selection-mode
and the items expand accordingly.