Skip to content

Commit

Permalink
Merge pull request #186 from nagisaando/doc/global-utility-functions/…
Browse files Browse the repository at this point in the history
…add-story-a11y-configuration

docs(README): Update a11y recipe
  • Loading branch information
yannbf authored Sep 5, 2022
2 parents d7222ef + 885ecf7 commit ee31263
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ You can use it for multiple use cases, and here's an example that combines the s
```js
// .storybook/test-runner.js
const { getStoryContext } = require('@storybook/test-runner');
const { injectAxe, checkA11y } = require('axe-playwright');
const { injectAxe, checkA11y, configureAxe } = require('axe-playwright');

module.exports = {
async preRender(page, context) {
Expand All @@ -503,6 +503,11 @@ module.exports = {
return;
}

// Apply story-level a11y rules
await configureAxe(page, {
rules: storyContext.parameters?.a11y?.config?.rules,
})

// from Storybook 7.0 onwards, the selector should be #storybook-root
await checkA11y(page, '#root', {
detailedReport: true,
Expand Down

0 comments on commit ee31263

Please sign in to comment.