You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary:
- Configure `jest-axe`
- Adds `toHaveNoA11yViolations` matcher for jest tests
- Configure jest await async lint rule for toHaveNoA11yViolations matcher. This is so we don't forget to await the a11y checks. Also fixing some linting issues that were caught when this rule was enabled
- Adds an example a11y test for Title component
Note: this set up is similar to how `jest-axe` is set up in webapp (I referenced this [jest-axe webapp PR](Khan/webapp#5850)!)
Issue: WB-466
## Test plan:
- Run unit tests and linting to make sure there are no errors
- Manually tested jest-axe is working by making sure that it catches expected a11y errors locally. Used this example with headings that are out of order:
```tsx
test("expect a11y test to fail", async () => {
// Arrange
// Act
const {container} = render(
<div>
<h1>title1</h1>
<h3>title2</h3>
</div>,
);
// Assert
await expect(container).toHaveNoA11yViolations();
});
```
Author: beaesguerra
Reviewers: beaesguerra, jeresig
Required Reviewers:
Approved By: jeresig
Checks: ✅ codecov/project, ✅ Lint (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ gerald, ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ⏭️ Chromatic - Skip on Release PR (changesets), 🚫 Chromatic - Get results on regular PRs, ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Lint (ubuntu-latest, 20.x), ⏭️ Publish npm snapshot, ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ gerald, 🚫 Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️ Chromatic - Skip on Release PR (changesets), ⏭️ Publish npm snapshot, ⌛ undefined
Pull Request URL: #2262
0 commit comments