twobin / react-lazyload

Lazy load your component, image or anything matters the performance.
MIT License
5.85k stars 487 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 1 year ago

Have you tried creating a mock?

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