Skip to content

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