Skip to content

Commit a1890a3

Browse files
committed
introduce Storybook Storyshots with Story to Snapshot Test
1 parent ef37855 commit a1890a3

File tree

5 files changed

+278
-1
lines changed

5 files changed

+278
-1
lines changed

package-lock.json

Lines changed: 248 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"devDependencies": {
2121
"@storybook/addon-actions": "^4.0.0-alpha.6",
2222
"@storybook/addon-knobs": "^4.0.0-alpha.6",
23+
"@storybook/addon-storyshots": "^4.0.0-alpha.6",
2324
"@storybook/react": "^4.0.0-alpha.6",
2425
"babel-core": "^6.26.0",
2526
"babel-loader": "^7.1.4",

src/__snapshots__/App.snapshot.js.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,27 @@ exports[`Counter Snapshot renders 1`] = `
2828
1
2929
</p>
3030
`;
31+
32+
exports[`Storyshots Checkbox with checked 1`] = `
33+
<label>
34+
My Checkbox Label
35+
:
36+
<input
37+
checked={true}
38+
onChange={[Function]}
39+
type="checkbox"
40+
/>
41+
</label>
42+
`;
43+
44+
exports[`Storyshots Checkbox with unchecked 1`] = `
45+
<label>
46+
My Checkbox Label
47+
:
48+
<input
49+
checked={false}
50+
onChange={[Function]}
51+
type="checkbox"
52+
/>
53+
</label>
54+
`;

test/jest.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"testRegex": "((\\.|/*.)(snapshot))\\.js?$",
3-
"rootDir": ".."
3+
"rootDir": "..",
4+
"setupTestFrameworkScriptFile": "<rootDir>/test/jest.setup.js"
45
}

test/jest.setup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import initStoryshots from '@storybook/addon-storyshots';
2+
3+
initStoryshots();

0 commit comments

Comments
 (0)