typing fails if input matches selection
See original GitHub issueI have found what I believe to be a related issue to this one, which is documented in this CodeSandbox: https://codesandbox.io/s/userevent-unit-test-ncmgu?file=/src/App.test.js
Setup of the tested component
- contains a text input with an initial value of 1 string character (ex:
'1'
) - executes the
HTMLInputElement.select()
method on input focus so every new value completely overwrites the previous one
Test execution:
- Render the tested component with input
- Get the input by role
- Change the input value via
userEvent.type(...
(ex:'11123'
) - Notice the received input value is
'23'
and not'11123'
_Originally posted by @psullivan6 in https://github.com/testing-library/user-event/issues/521#issuecomment-796888618_
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
python - Asking the user for input until they give a valid response
The simplest way to accomplish this is to put the input method in a while loop. Use continue when you get bad input,...
Read more >Video: Input and error messages - Microsoft Support
On the Input Message tab, check the box next to Show input message when cell is selected. Type a Title if you want....
Read more ><input>: The Input (Form Input) element - HTML
The <input> HTML element is used to create interactive controls for web-based forms in order to accept data from the user; a wide...
Read more >Validating Input | Web Accessibility Initiative (WAI) - W3C
Be forgiving of different input formats Validation should aim to be as accommodating as possible of different forms of input for particular data...
Read more >Check Signal Attributes - MathWorks
Error when input signal does or does not match selected attributes exactly ... with the attributes in the subordinate General data type menu....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🎉 This issue has been resolved in version 13.0.14 🎉
The release is available on:
npm package (@latest dist-tag)
Your semantic-release bot 📦🚀
@fergusmcdonald Thanks for taking the time to look into this. 😃
This is one of the parts of which I’m not sure yet, why they were implemented the way they are.
When rewriting the implementation for
userEvent.type
I tried to maintain the behavior that was established before, unless it was already determined to be a bug caused by the previous implementation ofuserEvent.type
. One of the reasons for the rewrite was that it should allow us to isolate concerns like the one tackled byfireInputEventIfNeeded
and verify if the expectations laid out by the existing tests are correct.https://codesandbox.io/s/keyevent-vtdcc?file=/src/App.js