mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-16 11:44:01 +08:00
infiniteScroll: add infiniteScroll component (#15567)
This commit is contained in:
32
test/unit/specs/infiniteScroll.spec.js
Normal file
32
test/unit/specs/infiniteScroll.spec.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { createVue, wait, destroyVM } from '../util';
|
||||
|
||||
describe('InfiniteScroll', () => {
|
||||
let vm;
|
||||
afterEach(() => {
|
||||
destroyVM(vm);
|
||||
});
|
||||
|
||||
it('create', async() => {
|
||||
vm = createVue({
|
||||
template: `
|
||||
<ul ref="scrollTarget" v-infinite-scroll="load" style="height: 300px;overflow: auto;">
|
||||
<li v-for="i in count" style="display: flex;height: 50px;">{{ i }}</li>
|
||||
</ul>
|
||||
`,
|
||||
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;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user