Content-Length: 285916 | pFad | https://github.com/testing-library/testing-library-docs/pull/262#issuecomment-532343764

3D Update events doc for event.which usage on keyboard events by vernonk · Pull Request #262 · testing-library/testing-library-docs · GitHub
Skip to content

Update events doc for event.which usage on keyboard events #262

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

Merged
merged 1 commit into from
Sep 17, 2019

Conversation

vernonk
Copy link
Contributor

@vernonk vernonk commented Sep 17, 2019

When using fireEvent.keyDown the event.which value is a fallback of 0 unless the keyCode is passed. I thought this might be helpful for other folks trying the same.

e.g.

fireEvent.keyDown(domNode, { key: 'Enter', code: 13, charCode: 13 }); // event.which => 0

fireEvent.keyDown(domNode, { key: 'Enter', keyCode: 13 }); // event.which => 13

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks!

@kentcdodds kentcdodds merged commit dfed181 into testing-library:master Sep 17, 2019
@kentcdodds
Copy link
Member

@all-contributors please add @vernonk for docs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @vernonk! 🎉

@vernonk
Copy link
Contributor Author

vernonk commented Sep 17, 2019

Awesome. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/testing-library/testing-library-docs/pull/262#issuecomment-532343764

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy