Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook 8.5: Enable accessibility testing #2393

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react";

Check warning on line 1 in .storybook/preview.tsx

View workflow job for this annotation

GitHub Actions / Lint / Lint (ubuntu-latest, 20.x)

File ignored by default.
import wonderBlocksTheme from "./wonder-blocks-theme";
import {Decorator} from "@storybook/react";
import {color} from "@khanacademy/wonder-blocks-tokens";
Expand Down Expand Up @@ -145,7 +145,7 @@
},
},

tags: ["autodocs"],
tags: ["autodocs", "a11y-test"],
};

export default preview;
14 changes: 9 additions & 5 deletions .storybook/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { beforeAll } from 'vitest';
import { setProjectAnnotations } from '@storybook/react';
import * as projectAnnotations from './preview';
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";

Check warning on line 1 in .storybook/vitest.setup.ts

View workflow job for this annotation

GitHub Actions / Lint / Lint (ubuntu-latest, 20.x)

File ignored by default.
import {beforeAll} from "vitest";
import {setProjectAnnotations} from "@storybook/react";
import * as previewAnnotations from "./preview";

// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
const project = setProjectAnnotations([projectAnnotations]);
const annotations = setProjectAnnotations([
previewAnnotations,
a11yAddonAnnotations,
]);

beforeAll(project.beforeAll);
beforeAll(annotations.beforeAll);
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default mergeConfig(viteConfig, {
provider: "playwright",
},
// Make sure to adjust this pattern to match your stories files.
include: ["./__docs__/**/*.stories.@(ts|tsx)"],
stories: ["./__docs__/**/*.stories.@(ts|tsx)"],
setupFiles: [".storybook/vitest.setup.ts"],
},
});
Loading