From b41ffb691cce988ece0c37450e3e71ba5a88fe9e Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Wed, 21 Mar 2018 15:38:11 +0100 Subject: [PATCH] Fix storyshots renderer option --- addons/storyshots/README.md | 2 +- addons/storyshots/src/index.js | 2 +- .../storyshot.enzyme.test.js.snap | 298 +++++++++++------- 3 files changed, 185 insertions(+), 117 deletions(-) diff --git a/addons/storyshots/README.md b/addons/storyshots/README.md index 1744d2c8daad..5d1af9463357 100644 --- a/addons/storyshots/README.md +++ b/addons/storyshots/README.md @@ -349,7 +349,7 @@ Run a custom test function for each story, rather than the default (a vanilla sn ### `renderer` -Pass a custom renderer (such as enzymes `mount`) to record snapshots. +Pass a custom renderer (such as enzymes `mount`) to record snapshots. Note that setting `test` overrides `renderer`. ```js import initStoryshots from '@storybook/addon-storyshots'; diff --git a/addons/storyshots/src/index.js b/addons/storyshots/src/index.js index 3d651486582f..302492d62b1c 100644 --- a/addons/storyshots/src/index.js +++ b/addons/storyshots/src/index.js @@ -53,7 +53,7 @@ export default function testStorySnapshots(options = {}) { serializer: options.serializer, }; - const testMethod = options.test || snapshotWithOptions({ options: snapshotOptions }); + const testMethod = options.test || snapshotWithOptions(snapshotOptions); methods.forEach(method => { if (typeof testMethod[method] === 'function') { diff --git a/addons/storyshots/stories/__snapshots__/storyshot.enzyme.test.js.snap b/addons/storyshots/stories/__snapshots__/storyshot.enzyme.test.js.snap index 4457ca09552d..fda5d5e1a7d3 100644 --- a/addons/storyshots/stories/__snapshots__/storyshot.enzyme.test.js.snap +++ b/addons/storyshots/stories/__snapshots__/storyshot.enzyme.test.js.snap @@ -1,144 +1,212 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Storyshots Another Button with some emoji 1`] = ` - + + + `; exports[`Storyshots Another Button with text 1`] = ` - + + + + `; exports[`Storyshots Button with some emoji 1`] = ` - + + + `; exports[`Storyshots Button with text 1`] = ` - -`; - -exports[`Storyshots Welcome to Storybook 1`] = ` -
-

- Welcome to storybook -

-

- This is a UI component dev environment for your app. -

-

- We've added some basic stories inside the - - src/stories - - directory. -
- A story is a single state of one or more UI components. You can have as many stories as you want. -
- (Basically a story is like a visual test case.) -

-

- See these sample - - - for a component called - - Button - - . -

-

- Just like that, you can add your own components as stories. -
- You can also edit those components and see changes right away. -
- (Try editing the - - Button - - stories located at - - - src/stories/index.js - - .) -

-

- Usually we create stories with smaller UI components in the app. -
- Have a look at the - - - Writing Stories - - - section in our documentation. -

-

- - NOTE: - -
- Have a look at the - + +`; + +exports[`Storyshots Welcome to Storybook 1`] = ` + + +

- .storybook/webpack.config.js - - to add webpack loaders and plugins you are using in this project. -

-
+ +

+ Welcome to storybook +

+
+

+ This is a UI component dev environment for your app. +

+

+ We've added some basic stories inside the + + + src/stories + + + directory. +
+ A story is a single state of one or more UI components. You can have as many stories as you want. +
+ (Basically a story is like a visual test case.) +

+

+ See these sample + + + + + + for a component called + + + Button + + + . +

+

+ Just like that, you can add your own components as stories. +
+ You can also edit those components and see changes right away. +
+ (Try editing the + + + Button + + + stories located at + + + + src/stories/index.js + + + .) +

+

+ Usually we create stories with smaller UI components in the app. +
+ Have a look at the + + + + Writing Stories + + + + section in our documentation. +

+ +

+ + NOTE: + +
+ Have a look at the + + + .storybook/webpack.config.js + + + to add webpack loaders and plugins you are using in this project. +

+
+
+ + `;