-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Add renderer option to storyshots #2414
Merged
Hypnosphi
merged 15 commits into
storybookjs:release/3.3
from
ivx:add-renderer-option-to-storyshots
Dec 2, 2017
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
50a4b06
Add option in snapshot generator to use renderer from options if passed
tobilen 5ddb6b5
Use snapshot with options as default, pass on renderer to test-bodies
tobilen 8143264
Add option to pass serializer to storyshots
tobilen b4c7098
Add enzyme-to-json for serializing, initStoryshots with custom renderer
tobilen f42b29a
Extend readme
tobilen 2b2b27d
Move enzyme-to-json dependency to storyshots, split initStoryshots tests
tobilen 45755f9
Remove react-test-renderer storyshot snapshots, since they dont work yet
tobilen beda473
Add dependencies necessary to use enzyme in jest
tobilen c78e169
Use storyshots renderer option to use enzyme
tobilen e3c2fc0
Use storyshots renderer option to use enzyme, add snapshots to project
tobilen e762993
Use multisnapshots in test project
tobilen 9b1e319
Remove stored snapshots, since multi snapshots are different on the CI
tobilen 3bbbac5
Use enzymes render renderer.
tobilen 71421d8
Correctly use multiSnapshotTest in example project
tobilen 11800f8
Merge branch 'release/3.3' into add-renderer-option-to-storyshots
tobilen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"presets": ["env", "react"], | ||
"presets": ["env", "stage-0", "react"], | ||
"plugins": [ | ||
"transform-runtime" | ||
] | ||
|
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
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
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
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
140 changes: 140 additions & 0 deletions
140
addons/storyshots/stories/__snapshots__/storyshot.enzyme.test.js.snap
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,140 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Another Button with some emoji 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Another Button with text 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Button with some emoji 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
😀 😎 👍 💯 | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Button with text 1`] = ` | ||
<button | ||
className="css-1yjiefr" | ||
onClick={[Function]} | ||
> | ||
Hello Button | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Welcome to Storybook 1`] = ` | ||
<article | ||
className="css-1fqbdip" | ||
> | ||
<h1 | ||
className="css-nil" | ||
> | ||
Welcome to storybook | ||
</h1> | ||
<p> | ||
This is a UI component dev environment for your app. | ||
</p> | ||
<p> | ||
We've added some basic stories inside the | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
src/stories | ||
</code> | ||
|
||
directory. | ||
<br /> | ||
A story is a single state of one or more UI components. You can have as many stories as you want. | ||
<br /> | ||
(Basically a story is like a visual test case.) | ||
</p> | ||
<p> | ||
See these sample | ||
|
||
<a | ||
className="css-ca0824" | ||
onClick={[Function]} | ||
role="button" | ||
tabIndex="0" | ||
> | ||
stories | ||
</a> | ||
|
||
for a component called | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
Button | ||
</code> | ||
. | ||
</p> | ||
<p> | ||
Just like that, you can add your own components as stories. | ||
<br /> | ||
You can also edit those components and see changes right away. | ||
<br /> | ||
(Try editing the | ||
<code | ||
className="css-mteq83" | ||
> | ||
Button | ||
</code> | ||
stories located at | ||
<code | ||
className="css-mteq83" | ||
> | ||
src/stories/index.js | ||
</code> | ||
.) | ||
</p> | ||
<p> | ||
Usually we create stories with smaller UI components in the app. | ||
<br /> | ||
Have a look at the | ||
|
||
<a | ||
className="css-ca0824" | ||
href="https://storybook.js.org/basics/writing-stories" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
Writing Stories | ||
</a> | ||
|
||
section in our documentation. | ||
</p> | ||
<p | ||
className="css-bwdon3" | ||
> | ||
<b> | ||
NOTE: | ||
</b> | ||
<br /> | ||
Have a look at the | ||
|
||
<code | ||
className="css-mteq83" | ||
> | ||
.storybook/webpack.config.js | ||
</code> | ||
|
||
to add webpack loaders and plugins you are using in this project. | ||
</p> | ||
</article> | ||
`; |
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,11 @@ | ||
import path from 'path'; | ||
import { mount } from 'enzyme'; | ||
import toJSON from 'enzyme-to-json'; | ||
import initStoryshots from '../src'; | ||
|
||
initStoryshots({ | ||
framework: 'react', | ||
configPath: path.join(__dirname, '..', '.storybook'), | ||
renderer: mount, | ||
serializer: toJSON, | ||
}); |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed? Can we include the particular transform instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the destructuring assignment here: https://github.com/storybooks/storybook/pull/2414/files#diff-75fdf0f2c6757366489b97c6898ea585R6
i would have used stage-2, but storybook itself pulls in stage-0, so i went with that to stay consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. I wonder if we can remove this nested
.babelrc
to avoid confusion@ndelangen what do you think?