Skip to content

Commit

Permalink
Fix tests and add comment character
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jan 14, 2025
1 parent 5481065 commit 924aad1
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}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'));
Expand Down

0 comments on commit 924aad1

Please sign in to comment.