Skip to content

Commit a2f39fc

Browse files
authored
1 parent 99c9fcd commit a2f39fc

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

docs/dom-testing-library/api-events.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,9 @@ fireEvent.change(getByLabelText(/picture/i), {
6464
element in the DOM and the key you want to fire.
6565

6666
```javascript
67-
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })
67+
fireEvent.keyDown(domNode, { key: 'Enter', code: 'Enter' })
6868

69-
// note: you should set the charCode or it will be fallback to 0
70-
// will fire a KeyboardEvent with charCode = 13
71-
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })
72-
73-
// If using event.which, be sure to set the keyCode or it will be fallback to 0
74-
// will fire a KeyboardEvent with expected which = 13
75-
fireEvent.keyDown(domNode, { key: 'Enter', keyCode: 13 })
76-
77-
// will fire a KeyboardEvent with charCode = 65
78-
fireEvent.keyDown(domNode, { key: 'A', code: 65, charCode: 65 })
69+
fireEvent.keyDown(domNode, { key: 'A', code: 'KeyQ' })
7970
```
8071

8172
You can find out which key code to use at

0 commit comments

Comments
 (0)