[bugfix] Tabs: incorrect line position in some cases (#3961)

This commit is contained in:
neverland
2019-07-25 19:03:16 +08:00
committed by GitHub
parent f52890cfd6
commit 3c2270a5ad
20 changed files with 154 additions and 168 deletions
-17
View File
@@ -1,14 +1,6 @@
import List from '..';
import { mount, later, mockGetBoundingClientRect } from '../../../test/utils';
function mockOffsetParent(el) {
Object.defineProperty(el, 'offsetParent', {
get() {
return {};
}
});
}
test('load event', async () => {
const wrapper = mount(List);
@@ -16,8 +8,6 @@ test('load event', async () => {
wrapper.vm.loading = value;
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeTruthy();
expect(wrapper.emitted('input')).toBeTruthy();
@@ -37,8 +27,6 @@ test('error loaded, click error-text and reload', async () => {
}
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeFalsy();
@@ -70,8 +58,6 @@ test('finished', async () => {
}
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeFalsy();
expect(wrapper.emitted('input')).toBeFalsy();
@@ -114,7 +100,6 @@ test('check the case that scroller is not window', async () => {
const listRef = wrapper.find({
ref: 'list'
});
mockOffsetParent(listRef.vm.$el);
await later();
expect(listRef.emitted('load')).toBeTruthy();
@@ -133,8 +118,6 @@ test('check the direction props', async () => {
}
});
mockOffsetParent(wrapper.vm.$el);
await later();
let children = wrapper.findAll('.van-list > div');