From c261bcc4a72496ef10abeca38d7d8c31598b5cfc Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sat, 2 Jan 2021 20:51:50 +0800 Subject: [PATCH] test: rename destroy to unmount --- src/collapse/test/index.legacy.js | 2 +- src/count-down/test/index.legacy.js | 2 +- src/field/test/index.legacy.js | 2 +- src/image/test/index.legacy.js | 6 +++--- src/index-bar/test/index.legacy.js | 2 +- src/number-keyboard/test/index.legacy.js | 2 +- src/picker/test/index.legacy.js | 2 +- src/popup/test/index.legacy.js | 6 +++--- src/sticky/test/index.legacy.js | 2 +- src/tab/test/index.legacy.js | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/collapse/test/index.legacy.js b/src/collapse/test/index.legacy.js index c0bedb633..1f3ef5ba2 100644 --- a/src/collapse/test/index.legacy.js +++ b/src/collapse/test/index.legacy.js @@ -39,7 +39,7 @@ test('basic mode', async () => { titles[0].trigger('click'); expect(wrapper.vm.active).toEqual([1]); - wrapper.destroy(); + wrapper.unmount(); }); test('accordion', async () => { diff --git a/src/count-down/test/index.legacy.js b/src/count-down/test/index.legacy.js index 3a3973b5f..6c1f5164e 100644 --- a/src/count-down/test/index.legacy.js +++ b/src/count-down/test/index.legacy.js @@ -177,7 +177,7 @@ test('incomplate format prop', () => { test('pause when unmounted', () => { const wrapper = mount(CountDown); expect(wrapper.vm.counting).toBeTruthy(); - wrapper.destroy(); + wrapper.unmount(); expect(wrapper.vm.counting).toBeFalsy(); }); diff --git a/src/field/test/index.legacy.js b/src/field/test/index.legacy.js index 9705ea330..420398a9c 100644 --- a/src/field/test/index.legacy.js +++ b/src/field/test/index.legacy.js @@ -393,7 +393,7 @@ test('call focus method before mounted', (done) => { }); test('destroy field', () => { - mount(Field).destroy(); + mount(Field).unmount(); }); test('colon prop', () => { diff --git a/src/image/test/index.legacy.js b/src/image/test/index.legacy.js index 10899ad34..1e2c79290 100644 --- a/src/image/test/index.legacy.js +++ b/src/image/test/index.legacy.js @@ -6,7 +6,7 @@ test('click event', () => { wrapper.trigger('click'); expect(wrapper.emitted('click')[0][0]).toBeTruthy(); - wrapper.destroy(); + wrapper.unmount(); }); test('load event', () => { @@ -63,7 +63,7 @@ test('lazy-load load event', (done) => { hanlder({ el: wrapper.find('img').element }); expect(wrapper.emitted('load').length).toEqual(1); expect(wrapper.html()).toMatchSnapshot(); - wrapper.destroy(); + wrapper.unmount(); }); } }, @@ -89,7 +89,7 @@ test('lazy-load error event', (done) => { hanlder({ el: wrapper.find('img').element }); expect(wrapper.emitted('error').length).toEqual(1); expect(wrapper.html()).toMatchSnapshot(); - wrapper.destroy(); + wrapper.unmount(); }); } }, diff --git a/src/index-bar/test/index.legacy.js b/src/index-bar/test/index.legacy.js index ac0a17e1d..cccfb1ef7 100644 --- a/src/index-bar/test/index.legacy.js +++ b/src/index-bar/test/index.legacy.js @@ -118,7 +118,7 @@ test('should update active anchor after page scroll', () => { wrapper.setData({ sticky: true }); trigger(window, 'scroll'); expect(wrapper.html()).toMatchSnapshot(); - wrapper.vm.$destroy(); + wrapper.vm.$unmount(); Element.prototype.getBoundingClientRect = nativeRect; }); diff --git a/src/number-keyboard/test/index.legacy.js b/src/number-keyboard/test/index.legacy.js index 9d08c51a4..80b299be3 100644 --- a/src/number-keyboard/test/index.legacy.js +++ b/src/number-keyboard/test/index.legacy.js @@ -17,7 +17,7 @@ test('click number key', () => { clickKey(wrapper.findAll('.van-key')[0]); expect(wrapper.emitted('input')[0][0]).toEqual(1); - wrapper.destroy(); + wrapper.unmount(); }); test('click delete key', () => { diff --git a/src/picker/test/index.legacy.js b/src/picker/test/index.legacy.js index df0f9d636..1918e03bc 100644 --- a/src/picker/test/index.legacy.js +++ b/src/picker/test/index.legacy.js @@ -26,7 +26,7 @@ test('simple columns confirm & cancel event', () => { wrapper.find('.van-picker__cancel').trigger('click'); expect(wrapper.emitted('confirm')[0]).toEqual(['1990', 0]); expect(wrapper.emitted('cancel')[0]).toEqual(['1990', 0]); - wrapper.destroy(); + wrapper.unmount(); }); test('multiple columns confirm & cancel event', () => { diff --git a/src/popup/test/index.legacy.js b/src/popup/test/index.legacy.js index f7e185852..93bdecae7 100644 --- a/src/popup/test/index.legacy.js +++ b/src/popup/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, triggerDrag, later } from '../../../test'; let wrapper; afterEach(() => { - wrapper.destroy(); + wrapper.unmount(); }); test('lazy render', () => { @@ -40,10 +40,10 @@ test('popup lock scroll', () => { value: true, }, }); - wrapper1.vm.$destroy(); + wrapper1.vm.$unmount(); expect(document.body.classList.contains('van-overflow-hidden')).toBeTruthy(); - wrapper2.vm.$destroy(); + wrapper2.vm.$unmount(); expect(document.body.classList.contains('van-overflow-hidden')).toBeFalsy(); }); diff --git a/src/sticky/test/index.legacy.js b/src/sticky/test/index.legacy.js index 319f2784c..c49a069ed 100644 --- a/src/sticky/test/index.legacy.js +++ b/src/sticky/test/index.legacy.js @@ -164,7 +164,7 @@ test('trigger scroll when visibility changed', () => { observerCallback([{ intersectionRatio: 0 }]); expect(scroll).toHaveBeenCalledTimes(2); - wrapper.destroy(); + wrapper.unmount(); expect(unobserve).toHaveBeenCalledTimes(1); window.IntersectionObserver = originIntersectionObserver; diff --git a/src/tab/test/index.legacy.js b/src/tab/test/index.legacy.js index 2ea989c5a..d2e746a15 100644 --- a/src/tab/test/index.legacy.js +++ b/src/tab/test/index.legacy.js @@ -91,7 +91,7 @@ test('swipe to switch tab', async () => { expect(wrapper.html()).toMatchSnapshot(); await later(); - wrapper.destroy(); + wrapper.unmount(); }); test('change tabs data', async () => {