-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
wrapper.simulate() should be wrapped in ReactTestUtils.act() #2084
Comments
This is already addressed by #2034. |
Out of curiosity, does that PR mean that any time a mounted component is rendered, it's wrapped in |
Only mount mounts components, so yes to both? Shallow rendering does not yet have an “act”, so that’s still unaddressed. |
@jquense there's a bunch of unpublished stuff in enzyme, for one, but you're right that simulate probably isn't covered. A PR to fix that would be great.
|
Could you re-open this issue then? |
It’s not fixable by enzyme until the shallow renderer provides an act, but sure. |
But it's not fixable for |
Ah, true, that is fixable. PRs welcome :-) even if they only have test cases. |
Thanks! I'll try to find time to contribute. I think this will be a huge improvement for users who need to force wrappers to update after simulating events to ensure that state updates are complete. |
@mikesteele let me know if you don't have any time . i'd be happy to put something together as well |
Feel free to race each other to get something up :-p thanks in advance! <3 |
@jquense I probably won't have time for a few weeks, feel free to take this |
Wraps the mount simulate method in ReactTestUtils.act() to correctly allow component interactions to be tested in a synchronous way Fixes enzymejs#2084
…Utils.act() Wraps the mount simulate method in ReactTestUtils.act() to correctly allow component interactions to be tested in a synchronous way Fixes enzymejs#2084
Is your feature request related to a problem? Please describe.
React 16.8 introduced act() to allow component interactions to be tested in a synchronous way.
Describe the solution you'd like
wrapper.simulate()
should be wrapped inact()
to ensure any state changes are resolved before proceeding.Describe alternatives you've considered
Though it's easy to forget
act
.Additional context
I have a feeling this is already on your roadmap, but I couldn't find an issue about it.
The text was updated successfully, but these errors were encountered: