import { createVue, wait, destroyVM } from '../util'; describe('InfiniteScroll', () => { let vm; afterEach(() => { destroyVM(vm); }); it('create', async() => { vm = createVue({ template: ` `, data() { return { count: 0 }; }, methods: { load() { this.count += 2; } } }, true); vm.$refs.scrollTarget.scrollTop = 2000; await wait(); expect(vm.$el.innerText.indexOf('2') > -1).to.be.true; }); it('invisible element not trigger', async() => { vm = createVue({ template: `
`, data() { return { count: 0 }; }, methods: { load() { this.count += 2; } } }, true); vm.$refs.scrollTarget.scrollTop = 2000; await wait(); expect(vm.$el.innerText.indexOf('2') > -1).to.be.false; }); });