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

docs: Add example to simulate click and then match snapshot #29

Closed
wants to merge 1 commit into from

Conversation

pedrottimark
Copy link
Contributor

Thinking more how I follow clear and short examples:

What do you think about an example of changing the state by simulating an event to contrast with calling setState directly in the existing example?

Some blog articles that I have read debate how much to call lifecycle methods in tests.

@pedrottimark
Copy link
Contributor Author

If you approve this change, I will need to edit test\examples.test.js and update its snapshot.

@codecov-io
Copy link

codecov-io commented Dec 5, 2016

Current coverage is 100% (diff: 100%)

Merging #29 into master will not change coverage

@@           master   #29   diff @@
===================================
  Files           3     3          
  Lines          46    46          
  Methods         0     0          
  Messages        0     0          
  Branches        0     0          
===================================
  Hits           46    46          
  Misses          0     0          
  Partials        0     0          

Powered by Codecov. Last update e010536...9d475b2

@adriantoine
Copy link
Owner

Hi again @pedrottimark!

Sorry but I want to keep the readme simple. The goal of this part is to show that you can use handy Enzyme wrapper functions and get a snapshot, but we don't have to demonstrate every Enzyme function, even if simulate is in Enzyme's readme.

If I had to change the readme, I'd rather show more example for mount and render wrappers, but it's not a big priority.

Thanks!

@adriantoine adriantoine closed this Dec 6, 2016
@pedrottimark pedrottimark deleted the example-click branch December 6, 2016 15:10
@pedrottimark
Copy link
Contributor Author

Yes, I agree that less is more, for the win :)

Here is a last question, from how your excellent project was recommended in an issue on Jest:

What do you think about the idea for it to become a .toJSON method in Enzyme package itself, so API to take a shallow snapshot becomes parallel to deep snapshot with react-test-renderer?

@adriantoine
Copy link
Owner

adriantoine commented Dec 6, 2016

I don't think it will ever become an internal Enzyme method, see enzymejs/enzyme#541, Enzyme maintainers are against it (and I respect that).

You may be interested in this: https://twitter.com/cpojer/status/806138327233609728

@adriantoine
Copy link
Owner

And I'm glad my project has been recommended, I didn't know actually 😮😊

@pedrottimark
Copy link
Contributor Author

Thank you for your patience to explain.

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

Successfully merging this pull request may close these issues.

3 participants