Reproduction example
https://codesandbox.io/p/sandbox/crazy-shape-j8gs37
Prerequisites
userEvent.type(input, "hello")
userEvent.tab()
No change event appears to be fired.
Expected behavior
When a user types something into an input on the browser and tabs away (or otherwise blurs the input), the input will fire a change event if the value is different. But when this is simulated via @testing-library/user-event, this does not happen. Note that we're talking about the browser's actual change event and not the synthetic one that React creates around input events.
Actual behavior
No change event is fired.
User-event version
14.6.1
Environment
Testing Library framework: @testing-library/dom@10.4.0
JS framework: N/A
Test environment: jest@29.7.0
DOM implementation: jsdom@26.0.0
Additional context
As a workaround, we can manually dispatch a change event / use fireEvent.change. But given @testing-library/user-event's focus on recreating actual user interactions, I'd expect that to happen automatically.
Reproduction example
https://codesandbox.io/p/sandbox/crazy-shape-j8gs37
Prerequisites
userEvent.type(input, "hello")userEvent.tab()No change event appears to be fired.
Expected behavior
When a user types something into an input on the browser and tabs away (or otherwise blurs the input), the input will fire a change event if the value is different. But when this is simulated via
@testing-library/user-event, this does not happen. Note that we're talking about the browser's actualchangeevent and not the synthetic one that React creates aroundinputevents.Actual behavior
No change event is fired.
User-event version
14.6.1
Environment
Testing Library framework:
@testing-library/dom@10.4.0JS framework: N/A
Test environment:
jest@29.7.0DOM implementation:
jsdom@26.0.0Additional context
As a workaround, we can manually dispatch a change event / use
fireEvent.change. But given@testing-library/user-event's focus on recreating actual user interactions, I'd expect that to happen automatically.