We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@testing-library/user-event version: 12.6.0 Testing Framework and version: Jest v. 26.6 DOM Environment: jsdom v. 16.4.0
Relevant code or config
// test: userEvent.type(ui.input.get(), '{arrowdown}'); // code: switch (event.code) { // "user-event" doesn't fill this property properly: event.code === '' case 'ArrowDown': { ... } }
What you did: I handle keyboard event by key code.
What happened:
Generated by package event doesn't contain value of event.code (actually it contains an empty string)
Reproduction repository: none
Problem description: In type.js file for example for event of pressing "ArrowDown" key populated properties such as key and keyCode but not a code:
key
keyCode
code
function handleArrowDown({currentElement, eventOverrides}) { const key = 'ArrowDown' const keyCode = 40 _dom.fireEvent.keyDown(currentElement(), { key, keyCode, which: keyCode, ...eventOverrides }); ... }
Suggested solution: Adding code to corresponding places, e.g.:
function handleArrowDown({currentElement, eventOverrides}) { const key = 'ArrowDown' const keyCode = 40 const code = 'ArrowDown'; _dom.fireEvent.keyDown(currentElement(), { code, key, keyCode, which: keyCode, ...eventOverrides }); ... }
Also it should be done for all other keys.
P.S. code looks like the same as key but it is not. Value of code is independent of modifiers like shift and used language.
shift
The text was updated successfully, but these errors were encountered:
See #456 and #521
Sorry, something went wrong.
Thanks. I closed the ticket as duplicate.
No branches or pull requests
@testing-library/user-event version: 12.6.0
Testing Framework and version: Jest v. 26.6
DOM Environment: jsdom v. 16.4.0
Relevant code or config
What you did:
I handle keyboard event by key code.
What happened:
Generated by package event doesn't contain value of event.code (actually it contains an empty string)
Reproduction repository:
none
Problem description:
In type.js file for example for event of pressing "ArrowDown" key populated properties such as
key
andkeyCode
but not acode
:Suggested solution:
Adding
code
to corresponding places, e.g.:Also it should be done for all other keys.
P.S.
code
looks like the same askey
but it is not. Value ofcode
is independent of modifiers likeshift
and used language.The text was updated successfully, but these errors were encountered: