Skip to content

Commit 4d9149e

Browse files
authored
Merge pull request #2684 from modernweb-dev/fix/storybook-builder-addon-a11y
fix(storybook-builder): support @storybook/addon-a11y
2 parents 18cc7bf + c988a29 commit 4d9149e

File tree

7 files changed

+111
-54
lines changed

7 files changed

+111
-54
lines changed

.changeset/tame-forks-complain.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@web/storybook-builder': patch
3+
---
4+
5+
support @storybook/addon-a11y

package-lock.json

+90-53
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/storybook-builder/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"glob-promise": "^6.0.3",
6666
"lodash-es": "^4.17.21",
6767
"path-browserify": "^1.0.1",
68-
"rollup": "^4.4.0",
68+
"rollup": "^4.4.1",
6969
"rollup-plugin-external-globals": "^0.9.0",
7070
"slash": "^5.1.0"
7171
},

packages/storybook-builder/src/rollup-plugin-prebundle-modules.ts

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ export const CANDIDATES = [
9393
'react',
9494
'react-dom',
9595
'tocbot',
96+
97+
/* for @storybook/addon-a11y */
98+
'axe-core',
9699
];
97100

98101
function getReactDomShimAlias() {

packages/storybook-framework-web-components/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
},
6666
"devDependencies": {
6767
"@playwright/test": "^1.22.2",
68+
"@storybook/addon-a11y": "^7.0.0",
6869
"@storybook/addon-essentials": "^7.0.0",
6970
"@storybook/addon-interactions": "^7.0.0",
7071
"@storybook/addon-links": "^7.0.0",

packages/storybook-framework-web-components/tests/all-in-one.spec.js

+10
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ test.describe('all in one', () => {
4343
await expect(manager.toolbarItemByTitle('Apply outlines to the preview')).toBeVisible();
4444
});
4545

46+
test('renders @storybook/addon-a11y toolbar', async () => {
47+
await expect(manager.toolbarItemByTitle('Vision simulator')).toBeVisible();
48+
});
49+
4650
test('renders @storybook/addon-controls panel', async () => {
4751
const panelButton = manager.panelButtonByText('Controls');
4852
await panelButton.click();
@@ -60,4 +64,10 @@ test.describe('all in one', () => {
6064
await panelButton.click();
6165
await expect(panelButton).toHaveClass(/tabbutton-active/);
6266
});
67+
68+
test('renders @storybook/addon-a11y panel', async () => {
69+
const panelButton = manager.panelButtonByText('Accessibility');
70+
await panelButton.click();
71+
await expect(panelButton).toHaveClass(/tabbutton-active/);
72+
});
6373
});

packages/storybook-framework-web-components/tests/fixtures/all-in-one/.storybook/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const config = {
55
'@storybook/addon-essentials',
66
'@storybook/addon-links',
77
'@storybook/addon-interactions',
8+
'@storybook/addon-a11y',
89
],
910
framework: {
1011
name: '@web/storybook-framework-web-components',

0 commit comments

Comments
 (0)