Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions docs/dom-testing-library/api-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,9 @@ fireEvent.change(getByLabelText(/picture/i), {
element in the DOM and the key you want to fire.

```javascript
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })
fireEvent.keyDown(domNode, { key: 'Enter', code: 'Enter' })

// note: you should set the charCode or it will be fallback to 0
// will fire a KeyboardEvent with charCode = 13
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })

// If using event.which, be sure to set the keyCode or it will be fallback to 0
// will fire a KeyboardEvent with expected which = 13
fireEvent.keyDown(domNode, { key: 'Enter', keyCode: 13 })

// will fire a KeyboardEvent with charCode = 65
fireEvent.keyDown(domNode, { key: 'A', code: 65, charCode: 65 })
fireEvent.keyDown(domNode, { key: 'A', code: 'KeyQ' })
```

You can find out which key code to use at
Expand Down