storybook/docs/snippets/vue/accessibility-testing-with-jest-axe.js.mdx
2022-03-18 19:22:17 +01:00

24 lines
538 B
Plaintext

```js
// MyComponent.test.js
import { render } from '@testing-library/vue';
import { composeStories } from '@storybook/testing-vue';
import { axe, toHaveNoViolations } from 'jest-axe';
import * as MyComponentStories from './MyComponent.stories';
const { Accessible } = composeStories(MyComponentStories);
expect.extend(toHaveNoViolations);
test('Example accessibility test', async () => {
const { container } = render(Accessible());
const AxeResults = await axe(container);
expect(AxeResults).toHaveNoViolations();
});
```