storybook/docs/_snippets/storybook-addon-a11y-test-setup.md
2024-12-02 22:23:08 +00:00

3.3 KiB

import { beforeAll } from 'vitest';

import { setProjectAnnotations } from '@storybook/react';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);
import { beforeAll } from 'vitest';

import { setProjectAnnotations } from '@storybook/react';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);
import { beforeAll } from 'vitest';

// Replace @storybook/svelte with @storybook/sveltekit if you are using SvelteKit
import { setProjectAnnotations } from '@storybook/svelte';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);
import { beforeAll } from 'vitest';

// Replace @storybook/svelte with @storybook/sveltekit if you are using SvelteKit
import { setProjectAnnotations } from '@storybook/svelte';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);
import { beforeAll } from 'vitest';

import { setProjectAnnotations } from '@storybook/vue3';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);
import { beforeAll } from 'vitest';

import { setProjectAnnotations } from '@storybook/vue3';

// Import the a11y addon annotations
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';

// Optionally import your own annotations
import * as projectAnnotations from './preview';

const project = setProjectAnnotations([
  // Add the a11y addon annotations
  a11yAddonAnnotations,
  projectAnnotations,
]);

beforeAll(project.beforeAll);