[Improvement] Field: add is-link prop (#1347)

This commit is contained in:
neverland
2018-06-28 17:46:58 +08:00
committed by GitHub
parent 19d1c45121
commit 7d97a2fd85
5 changed files with 18 additions and 1 deletions

View File

@@ -1,6 +1,14 @@
import List from '..';
import { mount, later } from '../../../test/utils';
function mockOffsetParent(el) {
Object.defineProperty(el, 'offsetParent', {
get() {
return {};
}
});
}
test('load event', async() => {
const wrapper = mount(List);
@@ -8,6 +16,8 @@ test('load event', async() => {
wrapper.vm.loading = value;
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeTruthy();
expect(wrapper.emitted('input')).toBeTruthy();
@@ -26,6 +36,8 @@ test('finished', async() => {
}
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeFalsy();
expect(wrapper.emitted('input')).toBeFalsy();