Visitar URL original
USWDS - Storybook: Update Storybook to v8.6 by ericsorenson · Pull Request #6697 · uswds/uswds · GitHub
Skip to content
Merged
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 .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
references:
container: &container
docker:
- image: cimg/node:20.19.0-browsers
- image: cimg/node:24.16.0-browsers
environment:
CHROME_PATH: $(which google-chrome-stable)

Expand Down
15 changes: 2 additions & 13 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,9 @@ module.exports = {
name: "@storybook/html-webpack5",
options: {},
},
stories: [
"../packages/**/*.stories.mdx",
"../packages/**/**/*.stories.@(js|jsx|ts|tsx)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-a11y",
],
stories: ["../packages/**/**/*.stories.@(js|jsx|ts|tsx)"],
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
staticDirs: ["../dist"],
docs: {
autodocs: "tag",
},
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
Expand Down Expand Up @@ -118,7 +108,6 @@ module.exports = {
loader: "file-loader",
options: {
name: "[name].[ext]",
//outputPath: "../dist/img",
},
},
include: path.resolve(__dirname, "../packages"),
Expand Down
17 changes: 3 additions & 14 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,12 @@

<!-- Global styles -->
<style>
#root {
box-sizing: border-box;
}

#root * {
*,
*:before,
*:after {
box-sizing: border-box !important;
}

* {
box-sizing: border-box !important;
}

#root *:before,
#root *:after {
box-sizing: inherit;
}

html,
body {
font-size: 16px;
Expand Down
5 changes: 4 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import "../packages/uswds-core/src/js/start";
/** @type { import('@storybook/html').Preview } */
const preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
Comment thread
ethangardner marked this conversation as resolved.
Resolved
a11y: {
// Disable automatic a11y scanning in the browser — handled by test-runner instead
manual: true,
},
controls: {
matchers: {
color: /(background|color)$/i,
Expand Down
34 changes: 34 additions & 0 deletions .storybook/test-runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { getStoryContext } = require("@storybook/test-runner");
const { injectAxe, checkA11y } = require("axe-playwright");

/**
* @type {import('@storybook/test-runner').TestRunnerConfig}
*/
module.exports = {
async preVisit(page) {
await injectAxe(page);
},
async postVisit(page, context) {
const storyContext = await getStoryContext(page, context);

// Skip stories that opt out of a11y testing
if (
storyContext.parameters?.a11y?.disable ||
storyContext.parameters?.axe?.mode === "off" ||
storyContext.parameters?.axe?.skip === true
) {
return;
}

// Wait for any animations/transitions to settle
await page.waitForTimeout(200);

await checkA11y(page, "#storybook-root", {
detailedReport: true,
detailedReportOptions: {
html: true,
},
axeOptions: storyContext.parameters?.a11y?.options,
});
},
};
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 20.19.0
nodejs 24.16.0
Loading