-
Notifications
You must be signed in to change notification settings - Fork 89
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
Test a few React components #2614
Conversation
I had experimented with turning this off in order to improve test performance, and apparently that ended up being merged. Now if we're to do component testing, we'll be changing things globally on the document, so isolation is very much necessary.
This patch release fixes a bug where tooltips would label non-interactive triggers in an inaccessible way.
src/tile/SpotlightTile.test.tsx
Outdated
expect(await axe(container)).toHaveNoViolations(); | ||
// Name should be visible | ||
screen.getByText("Alice"); | ||
}, |
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.
We could add a lot more expectations here:
- avatar url
- expanded
- indicators
...
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.
Right, I've added some more expectations now. I wasn't able to test the specific avatar URL, as that requires a full Matrix client setup, and the indicators are (intentionally, IIRC?) excluded from the accessibility tree. But, there were still some useful things to test, and I actually caught a couple more accessibility issues this way!
Catching two accessibility issues along the way: we were putting the wrong accessible labels on the 'expand' button, and even the off-screen pages of the spotlight tile were being exposed to accessibility technologies rather than hidden.
fb6f2b8
to
d6985e0
Compare
ee42f64
to
2fe8095
Compare
2fe8095
to
e8278b4
Compare
Since so much of this code base is made up React components, we do need to test them, and I wanted to see how easy it would be to get some automated accessibility tests with axe up and running. Along the way I discovered the reason why we were seeing funny errors in our tests (it was because I had turned off Vitest's test isolation option), and the tests I wrote also caught a real accessibility issue in Compound Web.