DEV Community

Discussion on: What do you think of React Testing Library?

Collapse
 
ggallynn profile image
lynn

Is there a way to simulate events in RTL like Enzyme’s .simulate()?

Collapse
 
acostalima profile image
André Costa Lima • Edited

Yep! That would be fireEvent API.

Collapse
 
thatzacdavis profile image
Zachary Davis

The docs have some good examples of how to trigger events.

Collapse
 
kentcdodds profile image
Kent C. Dodds

Yes, though they're not simultated events. They're actual events like the ones the browser will fire when the user interacts with your component. Check it out here: testing-library.com/docs/dom-testi...