faency
faency copied to clipboard
[RFC] Write tests for existing components
Goals
- improve quality of components
- secure PRs and review with tests
- avoid regression
Background
What we know
- testing components with
@testing-library
What Radix-UI does
- writes "integration" tests for each of its components (ex)
- check accessibility violations with axe-jest
What's possible with Storybook
- integrating stories with testing-library
- write interaction tests, they run testing library under the hood
- write accessibility tests, they run axe under the hood
Storybook allows writing tests for stories instead of components.
Chromatic automates testing visual changes
https://www.chromatic.com/docs/
Proposals
- Test components with testing-library
- Add axe-jest to check for accessibility violations
- Write integration tests for related components, when it makes sense
- See if it's worth adding storybook integrations
- We should test components not extending radix primitives
- Testing accessibility is the most relevant part
- Testing interactions with component
- Avoid testing styles as it's redundant with stitches tests