Skip to content

Commit add403b

Browse files
committed
docs: update docs
1 parent d66588a commit add403b

File tree

1 file changed

+44
-8
lines changed

1 file changed

+44
-8
lines changed

website/docs/12.x/docs/api/events/user-event.mdx

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,10 @@ The `pressIn` and `pressOut` events are sent by default but can be skipped by pa
124124
**Typing (for each character)**:
125125
126126
- `keyPress`
127-
- `textInput` (optional)
128127
- `change`
129128
- `changeText`
130129
- `selectionChange`
131-
132-
The `textInput` event is sent only for multiline text inputs.
130+
- `contentSizeChange` (only multiline)
133131
134132
**Leaving the element**:
135133
@@ -144,7 +142,7 @@ The `submitEditing` event is skipped by default. It can sent by setting the `sub
144142
```ts
145143
clear(
146144
element: ReactTestInstance,
147-
}
145+
)
148146
```
149147
150148
Example
@@ -160,8 +158,6 @@ This function supports only host `TextInput` elements. Passing other element typ
160158
161159
### Sequence of events
162160
163-
The sequence of events depends on the `multiline` prop and passed options.
164-
165161
Events will not be emitted if the `editable` prop is set to `false`.
166162
167163
**Entering the element**:
@@ -175,12 +171,52 @@ Events will not be emitted if the `editable` prop is set to `false`.
175171
**Pressing backspace**:
176172
177173
- `keyPress`
178-
- `textInput` (optional)
179174
- `change`
180175
- `changeText`
181176
- `selectionChange`
182177
183-
The `textInput` event is sent only for multiline text inputs.
178+
**Leaving the element**:
179+
180+
- `endEditing`
181+
- `blur`
182+
183+
## `paste()`
184+
185+
```ts
186+
paste(
187+
element: ReactTestInstance,
188+
text: string,
189+
)
190+
```
191+
192+
Example
193+
194+
```ts
195+
const user = userEvent.setup();
196+
await user.paste(textInput, 'Text to paste');
197+
```
198+
199+
This helper simulates the user pasting given text to a `TextInput` element.
200+
201+
This function supports only host `TextInput` elements. Passing other element types will result in throwing an error.
202+
203+
### Sequence of events
204+
205+
Events will not be emitted if the `editable` prop is set to `false`.
206+
207+
**Entering the element**:
208+
209+
- `focus`
210+
211+
**Selecting all content**:
212+
213+
- `selectionChange`
214+
215+
**Pasting the text**:
216+
217+
- `change`
218+
- `changeText`
219+
- `selectionChange`
184220
185221
**Leaving the element**:
186222

0 commit comments

Comments
 (0)