-
-
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
simulate('change' ...) on input not updating its value #2426
Comments
If you want to change the input's value, set the value prop on it; if you want to invoke an If you're doing something unidiomatic for React, and binding events directly to reffed DOM elements, then you'll have to test them by directly interacting with the DOM elements as well. |
Can you please tell me how to do this in enzyme?
|
in this case, you're not actually using |
@ljharb But if simulate doesn't simulate the events How can I simulate my onChange function? I mean in my case I have an input text, it has a event onChange that updates the state and it have the attribute value with the state.
|
I'm late to the party. I just learned that |
Current behavior
As the title says, when I try to
simulate
achange
on my<input/>
, the input'svalue
remains the same - it doesn't change.Here is my HTML. This
<input/>
is within a<form/>
register
is from theuseForm
hook ofreact-hook-form
.Here is my mount.
The
<form/>
and<input/>
are within the<Signup/>
component.Here is my enzyme code
Here is the output
I don't see
value
anywhere.Expected behavior
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: