-
Notifications
You must be signed in to change notification settings - Fork 252
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
The type event doesn't work on elements without a value property #481
Comments
I think we should support |
Yay! Is there context on why it's currently unsupported? The change looks trivial but if I go there I'd like to make sure I'm not missing something. |
I can't remember 😅 so I guess we can just go forward. |
I've been looking for somewhere to make a contrib to one of these @testing-library packages and this looks good! I understand the problem, and I'm starting to get my head around how the code works and how to contribute... Is anyone else working on this or if I have time should I get something up? My understanding of the problem is that right now the current implementation only really handles an as the element we are typing on. But we want to be able to handle the fact that typing is the way the user does hotkeys right? Let me know if there is anything else I should know. This is my first time trying to contribute to open source so I may be slow to get going :-) |
@sethreidnz I don't think anyone's working on it. You can feel free to do so. I think your understanding is correct. I think the easiest way to approach this would be to add a test that does: When you're finished, it might make sense to refactor the test into a few separate use cases. Whatever feels right to you is probably fine. Thanks! |
Resolved in v13.0.0 🚀 https://codesandbox.io/s/charming-maxwell-0z65j?file=/src/counter.js The |
@testing-library/user-event
version: 12.1.10Relevant code or config
Reproduction repository
https://codesandbox.io/s/blissful-waterfall-p4fi4?file=/src/index.test.js
Problem description
The library doesn't seem to support the
type
event on elements that don't have avalue
property. This prevents testing scenarios with global keyboard shortcuts that trigger effects. For instance, in the above sandbox, we increment the counter when hittingctrl+k
(bound todocument.body
) as you can see in the Browser tab (make sure the document is focused).However, the test using
userEvent.type
doesn't pass (see Tests tab). It does withfireEvent.keyDown
.Is it in the vision of
user-event
to support this, or should it remain afireEvent
scenario? And if the latter, what is the rationale?The text was updated successfully, but these errors were encountered: