Skip to content

Commit 781dba7

Browse files
committed
Add unit test for the top direction load function
1 parent 839b934 commit 781dba7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/unit/specs/InfiniteLoading.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe('InfiniteLoading.vue', () => {
1919
isCustomSpinner: false,
2020
listContainerHeight: 200,
2121
listItemHeight: 20,
22+
direction: 'bottom',
2223
};
2324
},
2425
render(createElement) {
@@ -46,6 +47,7 @@ describe('InfiniteLoading.vue', () => {
4647
props: {
4748
distance: this.distance,
4849
onInfinite: this.onInfinite,
50+
direction: this.direction,
4951
},
5052
ref: 'infiniteLoading',
5153
},
@@ -217,4 +219,16 @@ describe('InfiniteLoading.vue', () => {
217219

218220
expect(vm.$el.querySelector('.custom-spinner')).to.be.ok;
219221
});
222+
223+
it('should load data when scroll top (direction attribute)', (done) => {
224+
vm.direction = 'top';
225+
vm.onInfinite = function test() {
226+
Vue.nextTick(() => {
227+
expect(isShow(vm.$el.querySelector('.loading-default'))).to.be.true;
228+
done();
229+
});
230+
};
231+
232+
vm.$mount('#app');
233+
});
220234
});

0 commit comments

Comments
 (0)