-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df61ed1
commit 18ebb6a
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Firing Events | ||
|
||
> **Note** | ||
> | ||
> Most projects have a few use cases for `fireEvent`, but the majority of the time you should probably use [`userEvent`](./user-event). | ||
## `fireEvent` | ||
|
||
```typescript | ||
fireEvent(instance: TestInstance, event: EventString, eventProperties?: Object) | ||
``` | ||
|
||
Fire CLI events. | ||
|
||
```javascript | ||
fireEvent( | ||
getByText(instance, 'Username:'), | ||
'write', | ||
{value: 'crutchcorn'} | ||
) | ||
``` | ||
|
||
## `fireEvent[eventName]` | ||
|
||
```typescript | ||
fireEvent[eventName](instance: TestInstance, eventProperties?: Object) | ||
``` | ||
|
||
Convenience methods for firing CLI events. Check out | ||
[src/event-map.js](https://github.com/crutchcorn/cli-testing-library/blob/main/src/event-map.js) | ||
for a full list as well as default `eventProperties`. |