mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-29 20:29:46 +08:00
test: rename destroy to unmount
This commit is contained in:
parent
1ff0c18d15
commit
c261bcc4a7
@ -39,7 +39,7 @@ test('basic mode', async () => {
|
|||||||
titles[0].trigger('click');
|
titles[0].trigger('click');
|
||||||
expect(wrapper.vm.active).toEqual([1]);
|
expect(wrapper.vm.active).toEqual([1]);
|
||||||
|
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('accordion', async () => {
|
test('accordion', async () => {
|
||||||
|
@ -177,7 +177,7 @@ test('incomplate format prop', () => {
|
|||||||
test('pause when unmounted', () => {
|
test('pause when unmounted', () => {
|
||||||
const wrapper = mount(CountDown);
|
const wrapper = mount(CountDown);
|
||||||
expect(wrapper.vm.counting).toBeTruthy();
|
expect(wrapper.vm.counting).toBeTruthy();
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
expect(wrapper.vm.counting).toBeFalsy();
|
expect(wrapper.vm.counting).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ test('call focus method before mounted', (done) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('destroy field', () => {
|
test('destroy field', () => {
|
||||||
mount(Field).destroy();
|
mount(Field).unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('colon prop', () => {
|
test('colon prop', () => {
|
||||||
|
@ -6,7 +6,7 @@ test('click event', () => {
|
|||||||
|
|
||||||
wrapper.trigger('click');
|
wrapper.trigger('click');
|
||||||
expect(wrapper.emitted('click')[0][0]).toBeTruthy();
|
expect(wrapper.emitted('click')[0][0]).toBeTruthy();
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('load event', () => {
|
test('load event', () => {
|
||||||
@ -63,7 +63,7 @@ test('lazy-load load event', (done) => {
|
|||||||
hanlder({ el: wrapper.find('img').element });
|
hanlder({ el: wrapper.find('img').element });
|
||||||
expect(wrapper.emitted('load').length).toEqual(1);
|
expect(wrapper.emitted('load').length).toEqual(1);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -89,7 +89,7 @@ test('lazy-load error event', (done) => {
|
|||||||
hanlder({ el: wrapper.find('img').element });
|
hanlder({ el: wrapper.find('img').element });
|
||||||
expect(wrapper.emitted('error').length).toEqual(1);
|
expect(wrapper.emitted('error').length).toEqual(1);
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -118,7 +118,7 @@ test('should update active anchor after page scroll', () => {
|
|||||||
wrapper.setData({ sticky: true });
|
wrapper.setData({ sticky: true });
|
||||||
trigger(window, 'scroll');
|
trigger(window, 'scroll');
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
wrapper.vm.$destroy();
|
wrapper.vm.$unmount();
|
||||||
|
|
||||||
Element.prototype.getBoundingClientRect = nativeRect;
|
Element.prototype.getBoundingClientRect = nativeRect;
|
||||||
});
|
});
|
||||||
|
@ -17,7 +17,7 @@ test('click number key', () => {
|
|||||||
clickKey(wrapper.findAll('.van-key')[0]);
|
clickKey(wrapper.findAll('.van-key')[0]);
|
||||||
expect(wrapper.emitted('input')[0][0]).toEqual(1);
|
expect(wrapper.emitted('input')[0][0]).toEqual(1);
|
||||||
|
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('click delete key', () => {
|
test('click delete key', () => {
|
||||||
|
@ -26,7 +26,7 @@ test('simple columns confirm & cancel event', () => {
|
|||||||
wrapper.find('.van-picker__cancel').trigger('click');
|
wrapper.find('.van-picker__cancel').trigger('click');
|
||||||
expect(wrapper.emitted('confirm')[0]).toEqual(['1990', 0]);
|
expect(wrapper.emitted('confirm')[0]).toEqual(['1990', 0]);
|
||||||
expect(wrapper.emitted('cancel')[0]).toEqual(['1990', 0]);
|
expect(wrapper.emitted('cancel')[0]).toEqual(['1990', 0]);
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('multiple columns confirm & cancel event', () => {
|
test('multiple columns confirm & cancel event', () => {
|
||||||
|
@ -3,7 +3,7 @@ import { mount, triggerDrag, later } from '../../../test';
|
|||||||
|
|
||||||
let wrapper;
|
let wrapper;
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('lazy render', () => {
|
test('lazy render', () => {
|
||||||
@ -40,10 +40,10 @@ test('popup lock scroll', () => {
|
|||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
wrapper1.vm.$destroy();
|
wrapper1.vm.$unmount();
|
||||||
expect(document.body.classList.contains('van-overflow-hidden')).toBeTruthy();
|
expect(document.body.classList.contains('van-overflow-hidden')).toBeTruthy();
|
||||||
|
|
||||||
wrapper2.vm.$destroy();
|
wrapper2.vm.$unmount();
|
||||||
expect(document.body.classList.contains('van-overflow-hidden')).toBeFalsy();
|
expect(document.body.classList.contains('van-overflow-hidden')).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ test('trigger scroll when visibility changed', () => {
|
|||||||
observerCallback([{ intersectionRatio: 0 }]);
|
observerCallback([{ intersectionRatio: 0 }]);
|
||||||
expect(scroll).toHaveBeenCalledTimes(2);
|
expect(scroll).toHaveBeenCalledTimes(2);
|
||||||
|
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
expect(unobserve).toHaveBeenCalledTimes(1);
|
expect(unobserve).toHaveBeenCalledTimes(1);
|
||||||
|
|
||||||
window.IntersectionObserver = originIntersectionObserver;
|
window.IntersectionObserver = originIntersectionObserver;
|
||||||
|
@ -91,7 +91,7 @@ test('swipe to switch tab', async () => {
|
|||||||
expect(wrapper.html()).toMatchSnapshot();
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
|
|
||||||
await later();
|
await later();
|
||||||
wrapper.destroy();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('change tabs data', async () => {
|
test('change tabs data', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user