@@ -54,7 +54,7 @@ change the state of the checkbox.
54
54
- [ API] ( #api )
55
55
- [ ` click(element, eventInit, options) ` ] ( #clickelement-eventinit-options )
56
56
- [ ` dblClick(element, eventInit, options) ` ] ( #dblclickelement-eventinit-options )
57
- - [ ` async type(element, text, [options])` ] ( #async- typeelement-text-options )
57
+ - [ ` type(element, text, [options]) ` ] ( #typeelement-text-options )
58
58
- [ ` upload(element, file, [{ clickInit, changeInit }]) ` ] ( #uploadelement-file--clickinit-changeinit- )
59
59
- [ ` clear(element) ` ] ( #clearelement )
60
60
- [ ` selectOptions(element, values) ` ] ( #selectoptionselement-values )
@@ -151,7 +151,7 @@ test('double click', () => {
151
151
})
152
152
```
153
153
154
- ### ` async type(element, text, [options])`
154
+ ### ` type(element, text, [options]) `
155
155
156
156
Writes ` text ` inside an ` <input> ` or a ` <textarea> ` .
157
157
@@ -160,17 +160,18 @@ import React from 'react'
160
160
import {render , screen } from ' @testing-library/react'
161
161
import userEvent from ' @testing-library/user-event'
162
162
163
- test (' type' , async () => {
163
+ test (' type' , () => {
164
164
render (< textarea / > )
165
165
166
- await userEvent .type (screen .getByRole (' textbox' ), ' Hello,{enter}World!' )
166
+ userEvent .type (screen .getByRole (' textbox' ), ' Hello,{enter}World!' )
167
167
expect (screen .getByRole (' textbox' )).toHaveValue (' Hello,\n World!' )
168
168
})
169
169
```
170
170
171
171
` options.delay ` is the number of milliseconds that pass between two characters
172
172
are typed. By default it's 0. You can use this option if your component has a
173
- different behavior for fast or slow users.
173
+ different behavior for fast or slow users. If you do this, you need to make sure
174
+ to ` await ` !
174
175
175
176
` type ` will click the element before typing. To disable this, set the
176
177
` skipClick ` option to ` true ` .
@@ -433,7 +434,7 @@ test('hover', () => {
433
434
434
435
Unhovers out of ` element ` .
435
436
436
- > See [ above] ( #async- hoverelement ) for an example
437
+ > See [ above] ( #hoverelement ) for an example
437
438
438
439
### ` paste(element, text, eventInit, options) `
439
440
0 commit comments