Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Allow passing options to react-test-renderer .create() method #76

Closed
wants to merge 1 commit into from

Conversation

jrdrg
Copy link

@jrdrg jrdrg commented Jan 25, 2017

This PR adds the ability to pass options to the react-test-renderer create method, for example to allow mocking refs as per https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html#mocking-refs-for-snapshot-testing

@jrdrg
Copy link
Author

jrdrg commented Jan 31, 2017

@arunoda @roonyh without this PR, running a snapshot test on a component that uses a ref will result in the following error:
screen shot 2017-01-31 at 10 56 28 am

@STRML
Copy link

STRML commented Feb 14, 2017

This fixes #58 - would be very useful for us to deal with components that use refs.

@jrdrg
Copy link
Author

jrdrg commented Feb 16, 2017

@roonyh can you take a look when you get a chance?

@testerez
Copy link

testerez commented Mar 4, 2017

With @jasonmorganson solution we could have a per-story mock: #58 (comment)
Maybe an even better solution would be to add it to story.options.storyshots.createNodeMock. It would be cleaner if we end up needing more configuration options...

That said, options passed to initStoryshots could still be usefull as a default.

@shilman
Copy link
Contributor

shilman commented Apr 15, 2017

Hey @jrdrg

Thank you so much for this PR! We're moving over to a mono-repo, since that makes a lot of sense for a project like this.

We would ❤️ it if you could create a PR here: https://github.com/storybooks/storybook

Please let me know if you have any q's and sorry for the hassle!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants