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
I see document.dispatchEvent(new Event('my-custom-event')) as anti pattern. In some cases it might require a redundant wrapping in act() because fireEvent does it out of the box.
Testing Library feature
fireEvent
Testing Library framework(s)
All
What category of rule is this?
Suggests an alternate way of doing something
Optional: other category of rule
No response
Code examples
// BAD
document.dispatchEvent(new Event('my-custom-event'))
// GOOD
fireEvent(document, new Event('my-custom-event'))
Anything else?
No response
Do you want to submit a pull request to make the new rule?
No
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Name for new rule
no-document-event
Description of the new rule
I see
document.dispatchEvent(new Event('my-custom-event'))
as anti pattern. In some cases it might require a redundant wrapping inact()
becausefireEvent
does it out of the box.Testing Library feature
fireEvent
Testing Library framework(s)
All
What category of rule is this?
Suggests an alternate way of doing something
Optional: other category of rule
No response
Code examples
Anything else?
No response
Do you want to submit a pull request to make the new rule?
No
The text was updated successfully, but these errors were encountered: