DEV Community

Discussion on: Understanding React Testing Library

 
dhaiwat10 profile image
Dhaiwat Pandya

Thanks for the reply!

I think we are on different pages here. I don't have any loading state in my component like you mentioned. By default, Testing Library doesn't actually load your image. It doesn't fire the 'onLoad' event. (That's what we are doing with fireEvent.load(), not updating any internal state.) Which is why you can test if the image is correctly displaying a loader using the code I mentioned.

Thread Thread
 
dhaiwat10 profile image
Dhaiwat Pandya

And all of these events are native, none are custom. 😁