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

Update defaults of allowMultipleExpanded and allowZeroExpanded to true #366

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

liamjohnston
Copy link
Contributor

An approach to improving default UX.

Related discussions:

I had to bypass commit hooks to get here. I didn't have luck correctly fixing an issue running yarn typecheck. Will come back to that later.

There are still github pages things to manage for this too, plus actually publishing the new version to npm. But that's only if/when we're happy with it.

Copy link

@wilsonespina wilsonespina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new default functionality works well, just a couple of nitpicks with the tests.

🕺

src/components/Accordion.spec.tsx Outdated Show resolved Hide resolved
@@ -10,7 +10,7 @@ import {

ReactDOM.render(
<div id="classic-accordion">
<Accordion>
<Accordion allowMultipleExpanded={false} allowZeroExpanded={false}>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the integration tests stick to testing the default Accordian behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was either update the tests or update the accordion, and I chose the lazy option 😬

Fair call, I will take a look.

Copy link
Contributor Author

@liamjohnston liamjohnston Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if I change it to run against the default settings, the integration test fails (as I expected).

However, the failing integration test in question is written assuming the old default behaviour. Whereas the other tests don't – they just test based on the DOM they see (e.g. if an accordion item is aria-expanded, the panel should be visible). The integration tests run in a browser (with puppeteer?).

The failing test opens the first panel, then expects that it can't be collapsed (because it's the only one open, and allowZeroExpanded:false was the default behaviour).

RAA doesn't add any DOM cues regarding allowMultipleExpanded or allowMultipleExpanded, so we can't really test against them.

I think the best course of action here is to remove that particular test. We already have an integration test that opening a panel works.

The alternative is adding more DOM guff like data-disallow-multiple-expanded/data-disallow-zero-expanded, but that feels like a too-big change to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(done)

fix typo

Co-authored-by: Wilson Espina <[email protected]>
@coveralls
Copy link

coveralls commented Aug 23, 2023

Coverage Status

coverage: 87.925%. remained the same when pulling cedb6b0 on feature/change-default-settings into 041929b on main.

…have changed).

- Remove integration test that was testing the old default, rather than the correct behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants