Skip to content

Commit 09bf93a

Browse files
author
Artemis330
committed
Add: a note about charCode defaults (#19)
testing-library/dom-testing-library#193
1 parent df30c24 commit 09bf93a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/api-events.md

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ element in the DOM and the key you want to fire.
6565

6666
```javascript
6767
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })
68+
69+
// note: you should set the charCode or it will be fallback to 0
70+
// will Fire an KeyboardEvent with charCode = 0
71+
fireEvent.keyDown(domNode, { key: 'Enter', code: 13 })
72+
73+
// will Fire an KeyboardEvent with charCode = 65
74+
fireEvent.keyDown(domNode, { key: 'A', code: 65, charCode: 65 })
6875
```
6976

7077
You can find out which key code to use at

0 commit comments

Comments
 (0)