fbredius/storybook

View on GitHub
docs/snippets/angular/storybook-addon-a11y-story-config.ts.mdx

Summary

Maintainability
Test Coverage
```ts
// MyComponent.stories.ts

import { Meta, Story } from '@storybook/angular';

import { MyComponent } from './MyComponent.component';

export default {
  /* 👇 The title prop is optional.
  * See https://storybook.js.org/docs/angular/configure/overview#configure-story-loading 
  * to learn how to generate automatic titles
  */
  title: 'Configure a11y addon',
  component: MyComponent,
} as Meta;

const Template: Story = () => ({});

export const ExampleStory = Template.bind({});
ExampleStory.parameters = {
  a11y: {
    element: '#root',
    config: {
      rules: [
        {
          // The autocomplete rule will not run based on the CSS selector provided
          id: 'autocomplete-valid',
          selector: '*:not([autocomplete="nope"])',
        },
        {
          // Setting the enabled option to false will disable checks for this particular rule on all stories.
          id: 'image-alt',
          enabled: false,
        },
      ],
    },
    options: {},
    manual: true,
  },
};
```