Skip to content

Commit

Permalink
Merge pull request #30258 from storybookjs/shilman/add-a11y-test-caveat
Browse files Browse the repository at this point in the history
CLI: Update a11y-test comment with experimental caveat
  • Loading branch information
valentinpalkovic authored Jan 14, 2025
2 parents 426586d + 924aad1 commit af73cba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ describe('addonA11yAddonTest', () => {
},
// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
// The tag and its behavior are experimental and subject to change.
// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
tags: [/*'a11y-test'*/]
};
Expand Down Expand Up @@ -740,7 +741,8 @@ describe('addonA11yAddonTest', () => {
const preview: Preview = {
// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
// The tag and its behavior are experimental and subject to change.
// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
tags: ["existingTag"/*, "a11y-test"*/],
parameters: {
controls: {
Expand Down Expand Up @@ -824,7 +826,8 @@ describe('addonA11yAddonTest', () => {
},
// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
// The tag and its behavior are experimental and subject to change.
// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
tags: [/*"a11y-test"*/]
};"
`);
Expand All @@ -850,7 +853,8 @@ describe('addonA11yAddonTest', () => {
expect(transformed).toMatchInlineSnapshot(`
"export default {
// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run
// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
// The tag and its behavior are experimental and subject to change.
// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon
tags: ["existingTag"/*, "a11y-test"*/],
parameters: {
controls: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export async function transformPreviewFile(source: string, filePath: string) {
const indentation = lines[tagsLineIndex]?.match(/^\s*/)?.[0];

// Add the comment with the same indentation level
const comment = `${indentation}// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run\n${indentation}// For more information please visit: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;
const comment = `${indentation}// The \`a11y-test\` tag controls whether accessibility tests are run as part of a standalone Vitest test run\n${indentation}// The tag and its behavior are experimental and subject to change.\n${indentation}// For more information please see: https://storybook.js.org/docs/writing-tests/accessibility-testing#configure-accessibility-tests-with-the-test-addon`;
lines.splice(tagsLineIndex, 0, comment);

return formatFileContent(filePath, lines.join('\n'));
Expand Down

0 comments on commit af73cba

Please sign in to comment.