-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow passing a
test
function to storyshots
See #1034
- Loading branch information
Showing
3 changed files
with
23 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
import initStoryshots from 'storyshots'; | ||
import initStoryshots, { justRender } from 'storyshots'; | ||
|
||
initStoryshots(); | ||
|
||
// initStoryshots({ test: justRender }); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import renderer from 'react-test-renderer'; | ||
import shallow from 'react-test-renderer/shallow'; | ||
|
||
export function snapshot({ story, context }) { | ||
const storyElement = story.render(context); | ||
const tree = renderer.create(storyElement).toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
} | ||
|
||
export function justRender({ story, context }) { | ||
const storyElement = story.render(context); | ||
const tree = renderer.create(storyElement); | ||
} |