twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.88k stars 488 forks source link

Not working with react testing library #386

Open sjaugmented opened 2 years ago

sjaugmented commented 2 years ago

All of my unit tests are failing with the console error: [TypeError: Cannot read properties of null (reading 'addEventListener')]

rbalves commented 2 years ago

Have you tried creating a mock?

jest.mock('react-lazyload', () => props => <div {...props} />)