Skip to content
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

Merged

Conversation

anveshmekala
Copy link
Contributor

@anveshmekala anveshmekala commented Jan 26, 2023

Related Issue: #5143

Summary

This PR will allow user to switch selection-mode and the items expand accordingly.

@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Jan 26, 2023
@anveshmekala anveshmekala marked this pull request as ready for review January 26, 2023 22:35
@anveshmekala anveshmekala requested a review from a team as a code owner January 26, 2023 22:35
@anveshmekala anveshmekala added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Jan 26, 2023
@@ -272,6 +271,7 @@ export class AccordionItem implements ConditionalSlotComponent {
//--------------------------------------------------------------------------

private determineActiveItem(): void {
this.selectionMode = getElementProp(this.el, "selection-mode", "multiple");
Copy link
Contributor

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") ... ?

Copy link
Contributor Author

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.

@anveshmekala anveshmekala removed the request for review from ashetland January 27, 2023 16:13
Copy link
Member

@jcfranco jcfranco left a 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']");
Copy link
Member

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. 😄

Copy link
Contributor Author

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.

@jcfranco
Copy link
Member

@Elijbet This one's another candidate for #6038.

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jan 30, 2023
@anveshmekala anveshmekala merged commit 8278d3e into master Jan 30, 2023
@anveshmekala anveshmekala deleted the anveshmekala/fix-accordion-dynamic-selection-mode-update branch January 30, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants