-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d029ef7
commit cbdeaa3
Showing
29 changed files
with
867 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
core/jest-extract/test/fixtures/story/VariantButton.data.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module.exports = { | ||
overview: { | ||
'0': { | ||
text: 'Gisselle Mohr', | ||
icon: 'Kaden Powlowski', | ||
fontSize: 12, | ||
}, | ||
'1': { | ||
text: 'Barbara Brakus', | ||
icon: 'Miss Dolly Ferry', | ||
fontSize: 22, | ||
}, | ||
'2': { | ||
text: 'Adah Nolan', | ||
icon: 'Anais Pagac', | ||
fontSize: 22, | ||
}, | ||
'3': { | ||
text: 'Jon Will', | ||
icon: 'Geraldine Metz', | ||
fontSize: 20, | ||
}, | ||
'4': { | ||
text: 'Mr. Dulce Rice', | ||
icon: 'Karianne Bins', | ||
fontSize: 16, | ||
}, | ||
'5': { | ||
text: 'Mrs. Jermey Jacobson', | ||
icon: 'Mikayla Gusikowski', | ||
fontSize: 29, | ||
}, | ||
'6': { | ||
text: 'Clark Hickle', | ||
icon: 'Marielle Durgan', | ||
fontSize: 16, | ||
}, | ||
'7': { | ||
text: 'Ibrahim Purdy', | ||
icon: 'Cullen Heller', | ||
fontSize: 27, | ||
}, | ||
'8': { | ||
text: 'Jody Legros', | ||
icon: 'Dedric Smitham', | ||
fontSize: 16, | ||
}, | ||
'9': { | ||
text: 'Ford Kunze', | ||
icon: 'Trinity Hickle', | ||
fontSize: 12, | ||
}, | ||
}, | ||
}; |
47 changes: 47 additions & 0 deletions
47
core/jest-extract/test/fixtures/story/VariantButton.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const path = require('path'); | ||
const { run } = require('axe-core'); | ||
const { reactRunDOM } = require('@component-controls/test-renderers'); | ||
require('@component-controls/jest-axe-matcher'); | ||
|
||
const { loadConfigurations } = require('@component-controls/config'); | ||
const { renderDocument } = require('@component-controls/test-renderers'); | ||
const { render, act } = require('@testing-library/react'); | ||
const { renderErr } = require('@component-controls/test-renderers'); | ||
|
||
const examples = require('./VariantButton.docs'); | ||
const data = require('./VariantButton.data'); | ||
|
||
describe('VariantButton', () => { | ||
const configPath = path.resolve( | ||
__dirname, | ||
'../../../../../plugins/cc-cli/test/.config', | ||
); | ||
const config = loadConfigurations(configPath); | ||
let renderedExamples = []; | ||
act(() => { | ||
renderedExamples = renderDocument(examples, config, data); | ||
}); | ||
if (!renderedExamples) { | ||
renderErr(); | ||
return; | ||
} | ||
renderedExamples.forEach(({ name, rendered, dataId, values }) => { | ||
describe(name, () => { | ||
const runTests = () => { | ||
it('snapshot', () => { | ||
const { asFragment } = render(rendered); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
it('accessibility', async () => { | ||
const axeResults = await reactRunDOM(rendered, run); | ||
expect(axeResults).toHaveNoAxeViolations(); | ||
}); | ||
}; | ||
if (values) { | ||
describe(dataId, runTests); | ||
} else { | ||
runTests(); | ||
} | ||
}); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
core/jest-extract/test/fixtures/story/VariantButton.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as path from 'path'; | ||
import { run, AxeResults } from 'axe-core'; | ||
import { reactRunDOM } from '@component-controls/test-renderers'; | ||
import '@component-controls/jest-axe-matcher'; | ||
import { loadConfigurations } from '@component-controls/config'; | ||
import { renderDocument } from '@component-controls/test-renderers'; | ||
import { render, act } from '@testing-library/react'; | ||
import { renderErr } from '@component-controls/test-renderers'; | ||
|
||
import * as examples from './VariantButton.docs'; | ||
|
||
describe('VariantButton', () => { | ||
const configPath = path.resolve( | ||
__dirname, | ||
'../../../../../plugins/cc-cli/test/.config', | ||
); | ||
const config = loadConfigurations(configPath); | ||
let renderedExamples: ReturnType<typeof renderDocument> = []; | ||
act(() => { | ||
renderedExamples = renderDocument(examples, config); | ||
}); | ||
if (!renderedExamples) { | ||
renderErr(); | ||
return; | ||
} | ||
renderedExamples.forEach(({ name, rendered }) => { | ||
describe(name, () => { | ||
it('snapshot', () => { | ||
const { asFragment } = render(rendered); | ||
expect(asFragment()).toMatchSnapshot(); | ||
}); | ||
it('accessibility', async () => { | ||
const axeResults = await reactRunDOM<AxeResults>(rendered, run); | ||
expect(axeResults).toHaveNoAxeViolations(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.