diff --git a/docs/_snippets/actions-filtering-example.md b/docs/_snippets/actions-filtering-example.md index 6cca5a26b27e..45bc0092f855 100644 --- a/docs/_snippets/actions-filtering-example.md +++ b/docs/_snippets/actions-filtering-example.md @@ -1,4 +1,4 @@ -```ts filename=".storybook/preview.ts" renderer="common" language="ts" +```ts filename=".storybook/preview.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using (e.g., react-vite, nextjs, svelte) import type { Preview } from '@storybook/your-framework'; @@ -9,25 +9,25 @@ const originalConsoleLog = console.log; const preview: Preview = { async beforeEach() { spyOn(console, 'log') - // Disable automatic logging in the actions panel - .mockName('') - .mockImplementation((args) => { - // Check if the log message matches a certain pattern - if (someCondition(args)) { - // Manually log an action - action('console.log')(args); - } - - // Call the original console.log function - originalConsoleLog(...args); - }); + // Disable automatic logging in the actions panel + .mockName('') + .mockImplementation((args) => { + // Check if the log message matches a certain pattern + if (someCondition(args)) { + // Manually log an action + action('console.log')(args); + } + + // Call the original console.log function + originalConsoleLog(...args); + }); }, }; export default preview; ``` -```js filename=".storybook/preview.js" renderer="common" language="js" +```js filename=".storybook/preview.js" renderer="common" language="js" tabTitle="CSF 3" import { action } from 'storybook/actions'; import { spyOn } from 'storybook/test'; @@ -35,18 +35,75 @@ const originalConsoleLog = console.log; export default { async beforeEach() { spyOn(console, 'log') - // Disable automatic logging in the actions panel - .mockName('') - .mockImplementation((args) => { - // Check if the log message matches a certain pattern - if (someCondition(args)) { - // Manually log an action - action('console.log')(args); - } - - // Call the original console.log function - originalConsoleLog(...args); - }); + // Disable automatic logging in the actions panel + .mockName('') + .mockImplementation((args) => { + // Check if the log message matches a certain pattern + if (someCondition(args)) { + // Manually log an action + action('console.log')(args); + } + + // Call the original console.log function + originalConsoleLog(...args); + }); }, }; ``` + +```ts filename=".storybook/preview.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +import { action } from 'storybook/actions'; +import { spyOn } from 'storybook/test'; + +const originalConsoleLog = console.log; + +export default definePreview({ + async beforeEach() { + spyOn(console, 'log') + // Disable automatic logging in the actions panel + .mockName('') + .mockImplementation((args) => { + // Check if the log message matches a certain pattern + if (someCondition(args)) { + // Manually log an action + action('console.log')(args); + } + + // Call the original console.log function + originalConsoleLog(...args); + }); + }, +}); +``` + + + +```js filename=".storybook/preview.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +import { action } from 'storybook/actions'; +import { spyOn } from 'storybook/test'; + +const originalConsoleLog = console.log; +export default definePreview({ + async beforeEach() { + spyOn(console, 'log') + // Disable automatic logging in the actions panel + .mockName('') + .mockImplementation((args) => { + // Check if the log message matches a certain pattern + if (someCondition(args)) { + // Manually log an action + action('console.log')(args); + } + + // Call the original console.log function + originalConsoleLog(...args); + }); + }, +}); +``` diff --git a/docs/_snippets/actions-spyon-basic-example.md b/docs/_snippets/actions-spyon-basic-example.md index c51c665b684f..89471b84c56c 100644 --- a/docs/_snippets/actions-spyon-basic-example.md +++ b/docs/_snippets/actions-spyon-basic-example.md @@ -1,4 +1,4 @@ -```ts filename=".storybook/preview.ts" renderer="common" language="ts" +```ts filename=".storybook/preview.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using (e.g., react-vite, nextjs, svelte) import type { Preview } from '@storybook/your-framework'; @@ -13,7 +13,7 @@ const preview: Preview = { export default preview; ``` -```js filename=".storybook/preview.js" renderer="common" language="js" +```js filename=".storybook/preview.js" renderer="common" language="js" tabTitle="CSF 3" import { spyOn } from 'storybook/test'; export default { @@ -22,3 +22,31 @@ export default { }, }; ``` + +```ts filename=".storybook/preview.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +import { spyOn } from 'storybook/test'; + +export default definePreview({ + async beforeEach() { + spyOn(console, 'log').mockName('console.log'); + }, +}); +``` + + + +```js filename=".storybook/preview.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +import { spyOn } from 'storybook/test'; + +export default definePreview({ + async beforeEach() { + spyOn(console, 'log').mockName('console.log'); + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-config-context-in-story.md b/docs/_snippets/addon-a11y-config-context-in-story.md index 8d52ad486e2d..6137488cea2b 100644 --- a/docs/_snippets/addon-a11y-config-context-in-story.md +++ b/docs/_snippets/addon-a11y-config-context-in-story.md @@ -1,4 +1,4 @@ -```ts filename="Button.stories.ts" renderer="common" language="ts" +```ts filename="Button.stories.ts" renderer="common" language="ts" tabTitle="CSF 3" // ...rest of story file export const ExampleStory: Story = { @@ -135,3 +135,57 @@ export const ExampleStory = { }, }; ``` + +```ts filename="Button.stories.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import Button from './Button'; + +const meta = preview.meta({ + component: Button, +}); + +export const ExampleStory = meta.story({ + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. + */ + context: { + include: ['body'], + exclude: ['.no-a11y-check'], + }, + }, + }, +}); +``` + + + +```js filename="Button.stories.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import Button from './Button'; + +const meta = preview.meta({ + component: Button, +}); + +export const ExampleStory = meta.story({ + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. + */ + context: { + include: ['body'], + exclude: ['.no-a11y-check'], + }, + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-config-in-meta-and-story.md b/docs/_snippets/addon-a11y-config-in-meta-and-story.md index b38c96394c30..643f79253e71 100644 --- a/docs/_snippets/addon-a11y-config-in-meta-and-story.md +++ b/docs/_snippets/addon-a11y-config-in-meta-and-story.md @@ -57,7 +57,7 @@ export const ExampleStory: Story = { }; ``` -```ts filename="Button.stories.ts" renderer="common" language="ts" +```ts filename="Button.stories.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc. import type { Meta, StoryObj } from '@storybook/your-framework'; @@ -117,7 +117,7 @@ export const ExampleStory: Story = { }; ``` -```js filename="Button.stories.js" renderer="common" language="js" +```js filename="Button.stories.js" renderer="common" language="js" tabTitle="CSF 3" import { Button } from './Button'; export default { @@ -511,3 +511,117 @@ export const ExampleStory = { }, }; ``` + +```ts filename="Button.stories.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { Button } from './Button'; + +const meta = preview.meta({ + component: Button, + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. + */ + context: {}, + /* + * Axe's configuration + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure + * to learn more about the available properties. + */ + config: {}, + /* + * Axe's options parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter + * to learn more about the available options. + */ + options: {}, + /* + * Configure test behavior + * See: https://storybook.js.org/docs/next/writing-tests/accessibility-testing#test-behavior + */ + test: 'error', + }, + }, + globals: { + a11y: { + // Optional flag to prevent the automatic check + manual: true, + }, + }, +}); + +export const ExampleStory = meta.story({ + parameters: { + a11y: { + // ...same config available as above + }, + }, + globals: { + a11y: { + // ...same config available as above + }, + }, +}); +``` + + + +```js filename="Button.stories.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { Button } from './Button'; + +const meta = preview.meta({ + component: Button, + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. + */ + context: {}, + /* + * Axe's configuration + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure + * to learn more about the available properties. + */ + config: {}, + /* + * Axe's options parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter + * to learn more about the available options. + */ + options: {}, + /* + * Configure test behavior + * See: https://storybook.js.org/docs/next/writing-tests/accessibility-testing#test-behavior + */ + test: 'error', + }, + }, + globals: { + a11y: { + // Optional flag to prevent the automatic check + manual: true, + }, + }, +}); + +export const ExampleStory = meta.story({ + parameters: { + a11y: { + // ...same config available as above + }, + }, + globals: { + a11y: { + // ...same config available as above + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-config-in-preview.md b/docs/_snippets/addon-a11y-config-in-preview.md index 4dfbf5e8bd55..9569c9fe451a 100644 --- a/docs/_snippets/addon-a11y-config-in-preview.md +++ b/docs/_snippets/addon-a11y-config-in-preview.md @@ -1,4 +1,4 @@ -```js filename=".storybook/preview.js" renderer="common" language="js" +```js filename=".storybook/preview.js" renderer="common" language="js" tabTitle="CSF 3" export default { parameters: { a11y: { @@ -31,7 +31,7 @@ export default { }; ``` -```ts filename=".storybook/preview.ts" renderer="common" language="ts" +```ts filename=".storybook/preview.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc. import type { Preview } from '@storybook/your-framework'; @@ -68,3 +68,77 @@ const preview: Preview = { export default preview; ``` + +```ts filename=".storybook/preview.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. Typically, this is the CSS selector for the part of the DOM you want to analyze. + */ + context: 'body', + /* + * Axe's configuration + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure + * to learn more about the available properties. + */ + config: {}, + /* + * Axe's options parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter + * to learn more about the available options. + */ + options: {}, + }, + }, + globals: { + a11y: { + // Optional flag to prevent the automatic check + manual: true, + }, + }, +}); +``` + + + +```js filename=".storybook/preview.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + parameters: { + a11y: { + /* + * Axe's context parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#context-parameter + * to learn more. Typically, this is the CSS selector for the part of the DOM you want to analyze. + */ + context: 'body', + /* + * Axe's configuration + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure + * to learn more about the available properties. + */ + config: {}, + /* + * Axe's options parameter + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter + * to learn more about the available options. + */ + options: {}, + }, + }, + globals: { + a11y: { + // Optional flag to prevent the automatic check + manual: true, + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-config-rules-in-story.md b/docs/_snippets/addon-a11y-config-rules-in-story.md index 5d02ed6ee1a6..3ea1497e0184 100644 --- a/docs/_snippets/addon-a11y-config-rules-in-story.md +++ b/docs/_snippets/addon-a11y-config-rules-in-story.md @@ -1,4 +1,4 @@ -```ts filename="Button.stories.ts" renderer="common" language="ts" +```ts filename="Button.stories.ts" renderer="common" language="ts" tabTitle="CSF 3" // ...rest of story file export const IndividualA11yRulesExample: Story = { @@ -23,7 +23,7 @@ export const IndividualA11yRulesExample: Story = { }; ``` -```js filename="Button.stories.js" renderer="common" language="js" +```js filename="Button.stories.js" renderer="common" language="js" tabTitle="CSF 3" // ...rest of story file export const IndividualA11yRulesExample = { @@ -165,3 +165,67 @@ export const IndividualA11yRulesExample = { }, }; ``` + +```ts filename="Button.stories.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import Button from './Button'; + +const meta = preview.meta({ + component: Button, +}); + +export const IndividualA11yRulesExample = meta.story({ + parameters: { + a11y: { + 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, + }, + ], + }, + }, + }, +}); +``` + + + +```js filename="Button.stories.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import Button from './Button'; + +const meta = preview.meta({ + component: Button, +}); + +export const IndividualA11yRulesExample = meta.story({ + parameters: { + a11y: { + 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, + }, + ], + }, + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-config-rulesets-in-preview.md b/docs/_snippets/addon-a11y-config-rulesets-in-preview.md index e06ccd559029..cc242d556a5f 100644 --- a/docs/_snippets/addon-a11y-config-rulesets-in-preview.md +++ b/docs/_snippets/addon-a11y-config-rulesets-in-preview.md @@ -1,4 +1,4 @@ -```ts filename=".storybook/preview.ts" renderer="common" language="ts" +```ts filename=".storybook/preview.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc. import type { Preview } from '@storybook/your-framework'; @@ -20,7 +20,7 @@ const preview: Preview = { export default preview; ``` -```js filename=".storybook/preview.js" renderer="common" language="js" +```js filename=".storybook/preview.js" renderer="common" language="js" tabTitle="CSF 3" export default { parameters: { a11y: { @@ -36,3 +36,45 @@ export default { }, }; ``` + +```ts filename=".storybook/preview.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + parameters: { + a11y: { + options: { + /* + * Opt in to running WCAG 2.x AAA rules + * Note that you must explicitly re-specify the defaults (all but the last array entry) + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter-examples for more details + */ + runOnly: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'best-practice', 'wcag2aaa'], + }, + }, + }, +}); +``` + + + +```js filename=".storybook/preview.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + parameters: { + a11y: { + options: { + /* + * Opt in to running WCAG 2.x AAA rules + * Note that you must explicitly re-specify the defaults (all but the last array entry) + * See https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter-examples for more details + */ + runOnly: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'best-practice', 'wcag2aaa'], + }, + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-disable.md b/docs/_snippets/addon-a11y-disable.md index 588c16b2637e..1e4e9c5d5706 100644 --- a/docs/_snippets/addon-a11y-disable.md +++ b/docs/_snippets/addon-a11y-disable.md @@ -20,7 +20,7 @@ export const NonA11yStory: Story = { }; ``` -```js filename="MyComponent.stories.js|jsx" renderer="react" language="js" +```js filename="MyComponent.stories.js|jsx" renderer="react" language="js" tabTitle="CSF 3" import { MyComponent } from './MyComponent'; export default { @@ -37,7 +37,7 @@ export const NonA11yStory = { }; ``` -```ts filename="MyComponent.stories.ts|tsx" renderer="react" language="ts" +```ts filename="MyComponent.stories.ts|tsx" renderer="react" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, nextjs-vite, etc. import type { Meta, StoryObj } from '@storybook/your-framework'; @@ -217,3 +217,43 @@ export const ExampleStory: Story = { }, }; ``` + +```ts filename="MyComponent.stories.ts|tsx" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { MyComponent } from './MyComponent'; + +const meta = preview.meta({ + component: MyComponent, +}); + +export const NonA11yStory = meta.story({ + globals: { + a11y: { + // This option disables all automatic a11y checks on this story + manual: true, + }, + }, +}); +``` + + + +```js filename="MyComponent.stories.js|jsx" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { MyComponent } from './MyComponent'; + +const meta = preview.meta({ + component: MyComponent, +}); + +export const NonA11yStory = meta.story({ + globals: { + a11y: { + // This option disables all automatic a11y checks on this story + manual: true, + }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-parameter-error-in-preview.md b/docs/_snippets/addon-a11y-parameter-error-in-preview.md index 4cdced1913a4..8938dff41f35 100644 --- a/docs/_snippets/addon-a11y-parameter-error-in-preview.md +++ b/docs/_snippets/addon-a11y-parameter-error-in-preview.md @@ -1,4 +1,4 @@ -```ts filename=".storybook/preview.ts" renderer="common" language="ts" +```ts filename=".storybook/preview.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc. import type { Preview } from '@storybook/your-framework'; @@ -12,7 +12,7 @@ const preview: Preview = { export default preview; ``` -```js filename=".storybook/preview.js" renderer="common" language="js" +```js filename=".storybook/preview.js" renderer="common" language="js" tabTitle="CSF 3" export default { // ... parameters: { @@ -21,3 +21,31 @@ export default { }, }; ``` + +```ts filename=".storybook/preview.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + // ... + parameters: { + // ๐Ÿ‘‡ Fail all accessibility tests when violations are found + a11y: { test: 'error' }, + }, +}); +``` + + + +```js filename=".storybook/preview.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite) +import { definePreview } from '@storybook/your-framework'; + +export default definePreview({ + // ... + parameters: { + // ๐Ÿ‘‡ Fail all accessibility tests when violations are found + a11y: { test: 'error' }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-parameter-example.md b/docs/_snippets/addon-a11y-parameter-example.md index 42df11421336..e57bdca01097 100644 --- a/docs/_snippets/addon-a11y-parameter-example.md +++ b/docs/_snippets/addon-a11y-parameter-example.md @@ -28,7 +28,7 @@ export const NoA11yFail: Story = { }; ``` -```ts filename="Button.stories.ts" renderer="common" language="ts" +```ts filename="Button.stories.ts" renderer="common" language="ts" tabTitle="CSF 3" // Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc. import type { Meta, StoryObj } from '@storybook/your-framework'; @@ -59,7 +59,7 @@ export const NoA11yFail: Story = { }; ``` -```js filename="Button.stories.js" renderer="common" language="js" +```js filename="Button.stories.js" renderer="common" language="js" tabTitle="CSF 3" import { Button } from './Button'; export default { @@ -252,3 +252,59 @@ export const NoA11yFail = { }, }; ``` + +```ts filename="Button.stories.ts" renderer="react" language="ts" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { Button } from './Button'; + +const meta = preview.meta({ + component: Button, + parameters: { + // ๐Ÿ‘‡ Applies to all stories in this file + a11y: { test: 'error' }, + }, +}); + +// ๐Ÿ‘‡ This story will use the 'error' value and fail on accessibility violations +export const Primary = meta.story({ + args: { primary: true }, +}); + +// ๐Ÿ‘‡ This story will not fail on accessibility violations +// (but will still run the tests and show warnings) +export const NoA11yFail = meta.story({ + parameters: { + a11y: { test: 'todo' }, + }, +}); +``` + + + +```js filename="Button.stories.js" renderer="react" language="js" tabTitle="CSF Next ๐Ÿงช" +import preview from '../.storybook/preview'; + +import { Button } from './Button'; + +const meta = preview.meta({ + component: Button, + parameters: { + // ๐Ÿ‘‡ Applies to all stories in this file + a11y: { test: 'error' }, + }, +}); + +// ๐Ÿ‘‡ This story will use the 'error' value and fail on accessibility violations +export const Primary = meta.story({ + args: { primary: true }, +}); + +// ๐Ÿ‘‡ This story will not fail on accessibility violations +// (but will still run the tests and show warnings) +export const NoA11yFail = meta.story({ + parameters: { + a11y: { test: 'todo' }, + }, +}); +``` diff --git a/docs/_snippets/addon-a11y-parameter-remove.md b/docs/_snippets/addon-a11y-parameter-remove.md index 2b376f75a269..2108405d0b64 100644 --- a/docs/_snippets/addon-a11y-parameter-remove.md +++ b/docs/_snippets/addon-a11y-parameter-remove.md @@ -13,7 +13,7 @@ const meta: Meta