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

Deprecate TestUtils.SimulateNative #11656

Closed
gaearon opened this issue Nov 25, 2017 · 3 comments · Fixed by #13407
Closed

Deprecate TestUtils.SimulateNative #11656

gaearon opened this issue Nov 25, 2017 · 3 comments · Fixed by #13407
Labels

Comments

@gaearon
Copy link
Collaborator

gaearon commented Nov 25, 2017

I'm not sure if it was ever intended to be a part of public API.

It's not documented, and its naming is misleading because it actually doesn't simulate a native event (oops!). It only simulates what React would do if it received that native event. It does that in a way that's very tightly coupled to the event system internals which is unfortunate. It is much better if we can educate people how to dispatch actual browser events in tests instead.

I think we should just deprecate it. We've removed most tests relying on it, and can leave a test or two until it can be deleted in the next major.

@gaearon
Copy link
Collaborator Author

gaearon commented Nov 25, 2017

cc @ljharb not sure if you folks use it?

@ljharb
Copy link
Contributor

ljharb commented Nov 25, 2017

I don't see any usage of it in all of our enzyme code; however, we haven't yet written an enzyme-adapter-react-native, so we might need it there for the .simulate() method.

However, I've grown to think the "simulate" event API in enzyme is actually a huge footgun and discourage its use anyways, so it's fine to deprecate by me :-)

@nhunzaker
Copy link
Contributor

Agreed! Simulate Native generates a fake event (not even a DOM event) that has always been confusing to me working on event system internals. It would be great to get rid of it.

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

Successfully merging a pull request may close this issue.

4 participants