Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-a11y: Move stories into addon #19114

Merged
merged 13 commits into from
Sep 12, 2022
63 changes: 63 additions & 0 deletions code/addons/a11y/template/stories/parameters.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import globalThis from 'global';

export default {
component: globalThis.Components.Button,
args: {
children: 'Click Me!',
},
parameters: {
chromatic: { disable: true },
},
};

export const Basic = {};

export const Violation = {
args: {
// empty on purpose to get a button with no text
children: '',
},
};

export const Checks = {
parameters: {
a11y: {
config: {},
options: {
checks: {
'color-contrast': { options: { noScroll: true } },
},
restoreScroll: true,
},
},
},
};

export const Targetted = {
parameters: {
a11y: {
element: 'button',
},
},
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it obvious this is doing something? Would it be better to do these kind of things in the HTML-based story file?


export const Blank = {
parameters: {
a11y: {
config: {
disableOtherRules: true,
// @ts-ignore
rules: [],
},
options: {},
},
},
};

export const Disabled = {
parameters: {
a11y: {
disable: true,
},
},
};
8 changes: 4 additions & 4 deletions code/cypress/integration/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ describe('Routing', () => {
it('should navigate to story addons-a11y-basebutton--default', () => {
visit('official-storybook');

cy.get('#addons-a11y-basebutton--label').click({ force: true });
cy.url().should('include', 'path=/story/addons-a11y-basebutton--label');
cy.get('#addons-controls--basic').click({ force: true });
cy.url().should('include', 'path=/story/addons-controls--basic');
});

it('should directly visit a certain story and render correctly', () => {
visit('official-storybook/?path=/story/addons-a11y-basebutton--label');
visit('official-storybook/?path=/story/basics-actionbar--single-item');

cy.getStoryElement().should('contain.text', 'Testing the a11y addon');
cy.getStoryElement().should('contain.text', 'Clear');
});
});
7 changes: 0 additions & 7 deletions code/examples/html-kitchen-sink/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
export const parameters = {
a11y: {
config: {},
options: {
checks: { 'color-contrast': { options: { noScroll: true } } },
restoreScroll: true,
},
},
docs: {
iframeHeight: '200px',
},
Expand Down
7 changes: 0 additions & 7 deletions code/examples/official-storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ export const decorators = [

export const parameters = {
exportedParameter: 'exportedParameter',
a11y: {
config: {},
options: {
checks: { 'color-contrast': { options: { noScroll: true } } },
restoreScroll: true,
},
},
actions: { argTypesRegex: '^on.*' },
options: {
storySort: (a, b) =>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions code/examples/server-kitchen-sink/.storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ export const decorators = [withLinks];
const port = process.env.SERVER_PORT || 1337;

export const parameters = {
a11y: {
config: {},
options: {
checks: { 'color-contrast': { options: { noScroll: true } } },
restoreScroll: true,
},
},
docs: {
iframeHeight: '200px',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ setCustomElementsManifest(customElementsManifest);
// setCustomElements(customElements);

export const parameters = {
a11y: {
config: {},
options: {
checks: { 'color-contrast': { options: { noScroll: true } } },
restoreScroll: true,
},
},
docs: {
iframeHeight: '200px',
},
Expand Down