Closed smoothdvd closed 5 years ago
Emm, in this project, I tested it through trigger the scroll
event manually, you can check out it in this test case, and do you have any idea about this topic?
@PeachScript I tested following jest test code and passed:
// Mock request load more data(comments)
axios.get.mockResolvedValue({ status: 200, data: mockCommentsMore });
...
wrapper.find(InfiniteLoading).vm.$emit('infinite');
setTimeout(() => {
expect(wrapper.vm.comments.length).toBe(2);
expect(wrapper.vm.comments[1].commentID).toBe(2179712);
done();
}, 10);
Did I do the right thing?
@smoothdvd I totally agree with you, because listen scroll event is this plugin's job, so this plugin need to make sure it can convert correctly from scroll event to infinite
event, for any project that use this plugin, it just need to care about infinite
event rather than scroll event :P
As title