You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/fire-event.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,8 @@ The `fireEvent` API triggers event handlers on both host and composite component
15
15
16
16
Unlike User Event, this API does not automatically pass event object to event handler, this is responsibility of the user to construct such object.
17
17
18
+
The base `fireEvent(instance, eventName, ...data)` API can pass multiple custom arguments to the handler. Convenience helpers such as `fireEvent.press` and `fireEvent.scroll` are different: they create a default event object and accept one optional object to merge into it.
19
+
18
20
This function uses async `act` internally to execute all pending React updates during event handling.
19
21
20
22
```jsx
@@ -64,11 +66,11 @@ FireEvent exposes convenience methods for common events like: `press`, `changeTe
64
66
```tsx
65
67
fireEvent.press: (
66
68
instance: TestInstance,
67
-
...data: Array<any>,
68
-
) =>Promise<unknown>
69
+
eventProps?:Record<string, unknown>,
70
+
) =>Promise<void>
69
71
```
70
72
71
-
Invokes `press` event handler on the element or parent element in the tree.
73
+
Builds a press event object, merges `eventProps` into it, and invokes the `press`handler on the element or nearest eligible parent.
0 commit comments