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

update docs to note future deprecation of .simulate #2182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

browne0
Copy link

@browne0 browne0 commented Jul 1, 2019

This PR updates the doc to explain that simulate doesn't work as intended. I included a link to the original issue that I opened on Friday. #2173

@@ -1,5 +1,5 @@
{
"gitbook": "3.2.2",
"gitbook": "3.2.3",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was needed to get the docs working, looks like they updated the latest version.

@browne0
Copy link
Author

browne0 commented Jul 8, 2019

@ljharb Could I get a review on this? Thanks.

@azangru
Copy link

azangru commented Jul 15, 2019

Don't know if it's too much to ask, but I was wondering whether you might include an example of the officially blessed way of testing components' behavior in response to DOM events.

I am particularly curious about DOM-mounted components. It makes total sense to test shallow-rendered components by directly calling functions that they pass to their children as props, but for a fully mounted component, you might want to test it via its interactions with the DOM.

@ughitsaaron
Copy link

Would it be considered out of scope/desirable to add a warning output to the console when .simulate is called? Happy to make a PR to follow up.

@ljharb
Copy link
Member

ljharb commented Feb 14, 2020

@browne0 sorry for the long delay; i'll review this soon.

@azangru that would require a full simulation interface, which I want too, but is way too massive a project to be developed as part of enzyme. It's not as simple as clicks; you'd want to simulate things like "type foobar into the text field, hit tab, type baz, use the mouse to click a checkbox and then select from a dropdown, and then click into another text field and type quux, and then hit enter" - which involves a very large number of events, precisely timed and ordered, with a bunch of faked event objects.

@ughitsaaron no, I'm not interested in spamming warnings on every usage of the method, i'd rather just remove it in v4; if we used react's caching approach to only show the message once, it'll be ignored by humans anyways.

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 this pull request may close these issues.

4 participants