-
Notifications
You must be signed in to change notification settings - Fork 251
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
Problems with custom input types #501
Comments
nickserv
added
bug
Something isn't working
needs investigation
Someone has to do research on this
labels
Nov 30, 2020
Had the same problem here, thanks for pointing the workaround! :D |
We should apply the workaround in the helper: user-event/src/utils/edit/setSelectionRangeIfNecessary.ts Lines 39 to 44 in f251d15
|
2 tasks
🎉 This issue has been resolved in version 13.0.11 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@testing-library/user-event
version: 12.2.2Relevant code or config:
Reproduction repository:
https://codesandbox.io/s/user-event-and-typenumber-c5i10
Problem description:
After spending some time trying to solve this issue I've found what causing it. JSDOM has a limitation on
setSelectionRange
:https://github.com/jsdom/jsdom/blob/c2fb8ff94917a4d45e2398543f5dd2a8fed0bdab/lib/jsdom/living/nodes/HTMLInputElement-impl.js#L45
And you have a little hack to make it work with
userEvent.clear
:user-event/src/clear.js
Lines 12 to 27 in f7620ab
But if we are talking about type actions like
{selectall}
, well, it doesn't work for types other than["text", "search", "url", "tel", "password"]
. For now I'm just using:When I tried to move your hack to the
type.js
, I faced problems with testing (I can't testselectionStart
, because itnull
) and I wasn't sure how to temporary changeelement.type
.The text was updated successfully, but these errors were encountered: