-
Notifications
You must be signed in to change notification settings - Fork 933
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
Confusion about simulating keypresses in a Downshift component during testing #583
Comments
Hi! Try removing this line: input.value = inputText; When you do that react knows and when the change event is fired it doesn't think that the value was actually changed. |
Thanks! What's weird is that I could swear I already tried that--because I anticipated that might be the case--but when I just commented it out now, it worked! Would you mind if I submitted a PR to the docs on how to test the component or something? I had been messing with this for an hour or so and was getting pretty frustrated, so it'd be nice if future people in my situation have an easier time. |
Sure! 👍 |
thanks for the solution. This still exists in 2022. I have found out that with user-event v14 of RTL that:
|
Hello! Thanks for creating this excellent component, as well as react-testing-library, which I am also pleased with, and find far less confusing than enzyme.
However, I am having trouble testing the component I've made with Downshift, using react-testing-library. All I'd like to do is simulate typing input into a Downshift component, and ensuring that my
onInputValueChange
callback is being called properly, but it doesn't seem to be working.I've verified that my component actually works as expected through manual testing, so I know the problem isn't in how I'm using Downshift, but rather in how I'm trying to test it.
I've attempted to simplify my problem into a test case below. (The test is extra long because I'm trying a lot of different things to simulate input, none of which seem to work.)
Am I missing something really obvious here? Sorry if this isn't the proper place to ask.
The text was updated successfully, but these errors were encountered: