Skip to content
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

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

Closed
shilman opened this issue Apr 15, 2017 · 11 comments
Closed

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

shilman opened this issue Apr 15, 2017 · 11 comments

Comments

@shilman
Copy link
Member

shilman commented Apr 15, 2017

Issue by jrdrg
Wednesday Jan 25, 2017 at 23:09 GMT
Originally opened as storybook-eol/storyshots#76


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 included the following code: https://github.com/storybooks/storyshots/pull/76/commits

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by jrdrg
Tuesday Jan 31, 2017 at 15:58 GMT


@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

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by STRML
Tuesday Feb 14, 2017 at 03:40 GMT


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

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by jrdrg
Thursday Feb 16, 2017 at 18:57 GMT


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

@shilman
Copy link
Member Author

shilman commented Apr 15, 2017

Comment by testerez
Saturday Mar 04, 2017 at 00:26 GMT


With @jasonmorganson solution we could have a per-story mock: storybook-eol/storyshots#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.

@theinterned
Copy link
Member

Hi, what's the status on this? I need this functionality and would like to do what I can to get it merged.

@theinterned
Copy link
Member

Hi, I've made a proposal for a react component-based api for defining stories and passing arbitrary props: #993

@tmeasday
Copy link
Member

It's now possible to set a (admittedly global) createNodeMock via the storyshots test option.

We still need a solution to doing it per-story, I suppose. See @theinterned's linked discussion issues.

@shilman
Copy link
Member Author

shilman commented May 31, 2017

@tmeasday can we close this now, or do we want to continue the per-story discussion here?

@tmeasday
Copy link
Member

I think it's useful to have an open issue about this because it is something people need.

@stale
Copy link

stale bot commented Oct 31, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. We do try to do some housekeeping every once in a while so inactive issues will get closed after 90 days. Thanks!

@stale stale bot added the inactive label Oct 31, 2017
@stale
Copy link

stale bot commented Nov 2, 2017

Hey there, it's me again! I am going to help our maintainers close this issue so they can focus on development efforts instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants