Closed mikecfisher closed 4 years ago
I'd like to know this as well. At the moment, I'm calling the onChange method directly, like so:
act(() => {
wrapper
.find(Waypoint)
.prop('onPositionChange')
.call(null, { currentPosition: 'inside' });
});
wrapper.update();
expect(/*something to happen*/);
I also would like to know how to test this
The local test suite here could perhaps help? https://github.com/civiccc/react-waypoint/blob/master/test/waypoint_test.jsx
@trotzig thanks! This is a great reference. I was trying to avoid jasmine but I think I'll give in this time ;)
I think you could do something similar with jest, mocha etc as well.
I'm using this library a lot in a few apps, I haven't found a good example on how to test my components that use this. Say I want to simply write a test that asserts a specific function gets called when Waypoint scrolls into view. Are there any examples on the web I can look at?