From 924aad13634addfa125f939817d94cdcedc2941c Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 14 Jan 2025 13:18:52 +0100 Subject: [PATCH] Fix tests and add comment character --- .../automigrate/fixes/addon-a11y-addon-test.test.ts | 12 ++++++++---- .../src/automigrate/fixes/addon-a11y-addon-test.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.test.ts b/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.test.ts index dea04f604ff..26f8fb4daa5 100644 --- a/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.test.ts +++ b/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.test.ts @@ -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'*/] }; @@ -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: { @@ -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"*/] };" `); @@ -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: { diff --git a/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.ts b/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.ts index e3208f09b27..1ef2377afb5 100644 --- a/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.ts +++ b/code/lib/cli-storybook/src/automigrate/fixes/addon-a11y-addon-test.ts @@ -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}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`; + 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'));