-
Notifications
You must be signed in to change notification settings - Fork 2.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
Unable to test NumericInput key events with 'react-testing-library' #3454
Comments
Apparently this might be related to browsers (and thus perhaps |
Also, |
Issue opened against |
I found this, which seems to put a nail in the coffin of trying to test the effects of keyboard events: jsdom/jsdom#2102 "No, there are no user actions in jsdom." While keyboard event listeners will be triggered, the event will not act like a user typing and change the value of an input, and will not trigger a change event handler. |
It seems like you are trying to test the functionality of NumericInput itself, which is usually the responsibility of Blueprint's test suites, not yours. What are you actually trying to test? |
Environment
If possible, ink to a minimal repro:
https://codesandbox.io/s/w20nqx93pk
Steps to reproduce
onValueChange
NumericInput
withdata-testid
attribute andonValueChange
handler using 'react-testing-library'render
input
element using 'react-testing-library'getByTestId
input
using 'react-testing-library'fireEvent
simulating numeric key press (options{ key: '3' }
)Also
bp3-input-group
Actual behavior
onValueChange
handlerinput
element valueExpected behavior
onValueChange
handlerinput
element valuePossible solution
Evaluate the way that event handlers are attached and try to find where these events are getting 'lost'.
Test event handlers in unit tests.
The text was updated successfully, but these errors were encountered: