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

Support lifecycle methods #46

Open
albertfdp opened this issue Aug 1, 2017 · 2 comments
Open

Support lifecycle methods #46

albertfdp opened this issue Aug 1, 2017 · 2 comments

Comments

@albertfdp
Copy link

Hi!

I have some piece of code I'd like to test, however it's on componentWillReceiveProps. Currently, there doesn't seem to be a way to test this using unexpected-react.

A solution is to re-render the same component on the same DOM node, which React will re-render instead of remount. Example

I think adding this assertion could probably do the job:
<RenderedReactElement> when receiving new props <object> <assertion>

What do you think? Thanks!

@bruderstein
Copy link
Owner

bruderstein commented Aug 2, 2017 via email

@albertfdp
Copy link
Author

Nice, I didn't know it was as easy. The example I pointed was a lot more boilerplate.

I think it would be quite useful to add, testing these re-render lifecycles should have first-level support. Happy to add to do a PR for this if you can point me a bit on where to start.

Thanks!

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

No branches or pull requests

2 participants