Skip to content

Commit

Permalink
fix: docs accessibility test render
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 26, 2021
1 parent 0f22572 commit cb59397
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const renderedExamples = renderDocument(examples, config);
renderedExamples.forEach(({ name, rendered}) => {
it(name, async () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
});
describe(name, () => {
it('snapshot', () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
});
{{=it.allytest}}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ if (!renderedExamples.length) {
return;
}
renderedExamples.forEach(({ name, rendered}) => {
it(name, async () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
});
{{=it.allytest}}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ if (!renderedExamples) {
return;
}
renderedExamples.forEach(({ name, rendered}) => {
it(name, async () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();

describe(name, async () => {
it('snapshot', () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
});
{{=it.allytest}}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ describe('VariantButton', () => {
const config = loadConfigurations(configPath);
const renderedExamples = renderDocument(examples, config);
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ describe('VariantButton', () => {
const config = loadConfigurations(configPath);
const renderedExamples = renderDocument(examples, config);
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ describe('VariantButton', () => {
const config = loadConfigurations(configPath);
const renderedExamples = renderDocument(examples, config);
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = mount(rendered);
expect(toJson(component, { mode: 'deep' })).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM<AxeResults>(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
12 changes: 9 additions & 3 deletions plugins/cc-cli/test/__snapshots__/document-rtl-cjs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
describe(name, async () => {
it('snapshot', () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
12 changes: 9 additions & 3 deletions plugins/cc-cli/test/__snapshots__/document-rtl-esm.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
describe(name, async () => {
it('snapshot', () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
12 changes: 9 additions & 3 deletions plugins/cc-cli/test/__snapshots__/document-rtl-ts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
describe(name, async () => {
it('snapshot', () => {
const { asFragment } = render(rendered);
expect(asFragment()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM<AxeResults>(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
20 changes: 13 additions & 7 deletions plugins/cc-cli/test/__snapshots__/document-rtr-cjs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,19 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
20 changes: 13 additions & 7 deletions plugins/cc-cli/test/__snapshots__/document-rtr-esm.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down
20 changes: 13 additions & 7 deletions plugins/cc-cli/test/__snapshots__/document-rtr-ts.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ describe('VariantButton', () => {
return;
}
renderedExamples.forEach(({ name, rendered }) => {
it(name, async () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
describe(name, () => {
it('snapshot', () => {
const component = renderer.create(rendered);
if (!component) {
componentErr();
return;
}
expect(component.toJSON()).toMatchSnapshot();
});
it('accessibility', async () => {
const axeResults = await reactRunDOM<AxeResults>(rendered, run);
expect(axeResults).toHaveNoAxeViolations();
});
});
});
});
Expand Down

0 comments on commit cb59397

Please sign in to comment.