From e62780574691da1b1387a7042194126bc6512a96 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 13 Nov 2020 23:33:15 +0800 Subject: [PATCH] test: replace propsData with props --- src/action-bar/test/index.spec.js | 2 +- src/action-sheet/test/index.spec.js | 28 ++++----- src/address-edit/test/index.legacy.js | 20 +++---- src/address-list/test/index.legacy.js | 6 +- src/area/test/index.legacy.js | 12 ++-- src/badge/test/index.spec.js | 6 +- src/button/test/index.spec.js | 14 ++--- src/calendar/test/index.legacy.js | 44 +++++++------- src/calendar/test/prop.legacy.js | 26 ++++---- src/card/test/index.legacy.js | 2 +- src/cell/test/index.legacy.js | 6 +- src/checkbox/test/index.legacy.js | 6 +- src/circle/test/index.legacy.js | 8 +-- src/collapse/test/index.legacy.js | 4 +- src/contact-card/test/index.legacy.js | 2 +- src/contact-edit/test/index.legacy.js | 4 +- src/contact-list/test/index.legacy.js | 4 +- src/count-down/test/index.legacy.js | 26 ++++---- src/coupon-list/test/index.legacy.js | 12 ++-- .../test/date-picker.legacy.js | 20 +++---- .../test/datetime-picker.legacy.js | 2 +- .../test/time-picker.legacy.js | 14 ++--- src/dialog/test/index.legacy.js | 14 ++--- src/empty/test/index.legacy.js | 4 +- src/field/test/index.legacy.js | 44 +++++++------- src/icon/test/index.legacy.js | 12 ++-- src/image-preview/test/index.legacy.js | 20 +++---- src/image/test/index.legacy.js | 26 ++++---- src/list/test/index.legacy.js | 12 ++-- src/loading/test/index.legacy.js | 4 +- src/nav-bar/test/index.legacy.js | 8 +-- src/notice-bar/test/index.legacy.js | 8 +-- src/number-keyboard/test/index.legacy.js | 22 +++---- src/overlay/test/index.legacy.js | 8 +-- src/pagination/test/index.legacy.js | 4 +- src/picker/test/cascade.legacy.js | 16 ++--- src/picker/test/index.legacy.js | 30 +++++----- src/popup/test/index.legacy.js | 18 +++--- src/progress/test/index.legacy.js | 4 +- src/pull-refresh/test/index.legacy.js | 10 ++-- src/rate/test/index.legacy.js | 12 ++-- src/search/test/index.legacy.js | 8 +-- src/share-sheet/test/index.legacy.js | 14 ++--- src/skeleton/test/index.legacy.js | 8 +-- src/slider/test/index.legacy.js | 16 ++--- src/stepper/test/index.legacy.js | 48 +++++++-------- src/swipe-cell/test/index.legacy.js | 14 ++--- src/swipe/test/index.legacy.js | 6 +- src/switch/test/index.legacy.js | 8 +-- src/tab/test/index.legacy.js | 2 +- src/tabbar/test/index.legacy.js | 4 +- src/tag/test/index.legacy.js | 4 +- src/tree-select/test/index.legacy.js | 18 +++--- src/uploader/test/index.legacy.js | 60 +++++++++---------- 54 files changed, 377 insertions(+), 377 deletions(-) diff --git a/src/action-bar/test/index.spec.js b/src/action-bar/test/index.spec.js index d64a5f25d..39e18b18d 100644 --- a/src/action-bar/test/index.spec.js +++ b/src/action-bar/test/index.spec.js @@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils'; test('should allow to disable safe-area-inset-bottom prop', () => { const wrapper = mount(ActionBar, { - propsData: { + props: { safeAreaInsetBottom: false, }, }); diff --git a/src/action-sheet/test/index.spec.js b/src/action-sheet/test/index.spec.js index de3266abd..5b3d47237 100644 --- a/src/action-sheet/test/index.spec.js +++ b/src/action-sheet/test/index.spec.js @@ -4,7 +4,7 @@ import ActionSheet from '..'; test('should emit select event after clicking option', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option' }], }, @@ -18,7 +18,7 @@ test('should emit select event after clicking option', () => { test('should call callback function after clicking option', () => { const callback = jest.fn(); const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option', callback }], }, @@ -30,7 +30,7 @@ test('should call callback function after clicking option', () => { test('should not emit select event after clicking loading option', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option', loading: true }], }, @@ -42,7 +42,7 @@ test('should not emit select event after clicking loading option', () => { test('should not emit select event after clicking disabled option', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option', disabled: true }], }, @@ -54,7 +54,7 @@ test('should not emit select event after clicking disabled option', () => { test('should emit cancel event after clicking cancel button', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option' }], cancelText: 'Cancel', @@ -67,7 +67,7 @@ test('should emit cancel event after clicking cancel button', () => { test('should render subname and match snapshot', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option', subname: 'Subname' }], cancelText: 'Cancel', @@ -103,7 +103,7 @@ test('should render default slot and match snapshot', () => { test('should allow to use the teleport prop', () => { const root = document.createElement('div'); mount(ActionSheet, { - propsData: { + props: { show: true, teleport: root, }, @@ -114,7 +114,7 @@ test('should allow to use the teleport prop', () => { test('should have "van-popup--round" class when setting the round prop', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, round: true, }, @@ -125,7 +125,7 @@ test('should have "van-popup--round" class when setting the round prop', () => { test('should change option color when using the color prop', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option', color: 'red' }], }, @@ -138,7 +138,7 @@ test('should change option color when using the color prop', () => { test('should hide close icon when the closeable prop is false', async () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, title: 'Title', }, @@ -153,7 +153,7 @@ test('should hide close icon when the closeable prop is false', async () => { test('should allow to custom close icon with closeIcon prop', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, title: 'Title', closeIcon: 'cross', @@ -165,7 +165,7 @@ test('should allow to custom close icon with closeIcon prop', () => { test('should render description and match snapshot', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, description: 'This is a description', }, @@ -178,7 +178,7 @@ test('should render description and match snapshot', () => { test('should render description slot when match snapshot', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, }, slots: { @@ -193,7 +193,7 @@ test('should render description slot when match snapshot', () => { test('should close after clicking option if close-on-click-action prop is true', () => { const wrapper = mount(ActionSheet, { - propsData: { + props: { show: true, actions: [{ name: 'Option' }], closeOnClickAction: true, diff --git a/src/address-edit/test/index.legacy.js b/src/address-edit/test/index.legacy.js index 0052e2ebb..95651b2b0 100644 --- a/src/address-edit/test/index.legacy.js +++ b/src/address-edit/test/index.legacy.js @@ -16,7 +16,7 @@ const addressInfo = { const createComponent = () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { areaList, addressInfo, showPostal: true, @@ -43,7 +43,7 @@ test('create a AddressEdit', () => { test('create a AddressEdit with props', () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { areaList, addressInfo, showPostal: true, @@ -57,7 +57,7 @@ test('create a AddressEdit with props', () => { test('valid area placeholder confirm', async () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { areaList, areaColumnsPlaceholder: ['请选择', '请选择', '请选择'], }, @@ -96,7 +96,7 @@ test('set-default', () => { test('validator props', async () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { areaList, validator(key, value) { return `${key}${value}`; @@ -192,7 +192,7 @@ test('watch address info', () => { test('set/get area code', async () => { const wrapper = mount(AddressEdit, { - propsData: { areaList }, + props: { areaList }, }); expect(wrapper.vm.getArea()).toEqual([ @@ -218,7 +218,7 @@ test('set/get area code', async () => { test('watch area code', async () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { areaList: {}, addressInfo: { areaCode: '110101', @@ -235,7 +235,7 @@ test('watch area code', async () => { test('show search result', async () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { showSearchResult: true, searchResult: [ { name: 'name1', address: 'address1' }, @@ -265,7 +265,7 @@ test('show search result', async () => { test('delete address', async () => { const wrapper = mount(AddressEdit, { attachToDocument: true, - propsData: { + props: { showDelete: true, }, }); @@ -297,7 +297,7 @@ test('select area', () => { test('click-area event', () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { disableArea: true, }, }); @@ -309,7 +309,7 @@ test('click-area event', () => { test('tel-maxlength prop', () => { const wrapper = mount(AddressEdit, { - propsData: { + props: { telMaxlength: 4, }, }); diff --git a/src/address-list/test/index.legacy.js b/src/address-list/test/index.legacy.js index b749e4d54..613691a38 100644 --- a/src/address-list/test/index.legacy.js +++ b/src/address-list/test/index.legacy.js @@ -18,7 +18,7 @@ const list = [ test('unswitchable', () => { const wrapper = mount(AddressList, { - propsData: { + props: { list, switchable: false, }, @@ -30,7 +30,7 @@ test('unswitchable', () => { test('select event', () => { const onSelect = jest.fn(); const wrapper = mount(AddressList, { - propsData: { + props: { list, }, context: { @@ -48,7 +48,7 @@ test('select event', () => { test('click-item event', () => { const onClickItem = jest.fn(); const wrapper = mount(AddressList, { - propsData: { + props: { list, }, context: { diff --git a/src/area/test/index.legacy.js b/src/area/test/index.legacy.js index ec4ee113a..c6c1f41e1 100644 --- a/src/area/test/index.legacy.js +++ b/src/area/test/index.legacy.js @@ -18,7 +18,7 @@ test('confirm & cancel event', async () => { const onConfirm = jest.fn(); const onCancel = jest.fn(); const wrapper = mount(Area, { - propsData: { + props: { areaList, }, listeners: { @@ -38,7 +38,7 @@ test('confirm & cancel event', async () => { test('watch areaList & code', async () => { const wrapper = mount(Area, { - propsData: { + props: { areaList, }, }); @@ -58,7 +58,7 @@ test('watch areaList & code', async () => { test('change option', () => { const onChange = jest.fn(); const wrapper = mount(Area, { - propsData: { + props: { areaList, }, listeners: { @@ -82,7 +82,7 @@ test('change option', () => { test('getValues method', () => { const wrapper = mount(Area, { - propsData: { + props: { areaList, }, created() { @@ -95,7 +95,7 @@ test('getValues method', () => { test('reset method', async () => { const wrapper = mount(Area, { - propsData: { + props: { areaList, value: '120225', }, @@ -109,7 +109,7 @@ test('reset method', async () => { test('columns-num prop', async () => { const wrapper = mount(Area, { - propsData: { + props: { areaList, columnsNum: 3, }, diff --git a/src/badge/test/index.spec.js b/src/badge/test/index.spec.js index 371a11c00..61f286b60 100644 --- a/src/badge/test/index.spec.js +++ b/src/badge/test/index.spec.js @@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils'; test('should render nothing when badge is empty string', () => { const wrapper = mount(Badge, { - propsData: { + props: { badge: '', }, }); @@ -13,7 +13,7 @@ test('should render nothing when badge is empty string', () => { test('should render nothing when badge is undefined', () => { const wrapper = mount(Badge, { - propsData: { + props: { badge: undefined, }, }); @@ -23,7 +23,7 @@ test('should render nothing when badge is undefined', () => { test('should render nothing when badge is zero', () => { const wrapper = mount(Badge, { - propsData: { + props: { badge: 0, }, }); diff --git a/src/button/test/index.spec.js b/src/button/test/index.spec.js index e8061023e..9515281c6 100644 --- a/src/button/test/index.spec.js +++ b/src/button/test/index.spec.js @@ -10,7 +10,7 @@ test('should emit click event', () => { test('should not emit click event when disabled', () => { const wrapper = mount(Button, { - propsData: { + props: { disabled: true, }, }); @@ -21,7 +21,7 @@ test('should not emit click event when disabled', () => { test('should not emit click event when loading', () => { const wrapper = mount(Button, { - propsData: { + props: { loading: true, }, }); @@ -32,7 +32,7 @@ test('should not emit click event when loading', () => { test('should hide border when color is gradient', () => { const wrapper = mount(Button, { - propsData: { + props: { color: 'linear-gradient(#000, #fff)', }, }); @@ -42,7 +42,7 @@ test('should hide border when color is gradient', () => { test('should change icon class prefix when using icon-prefix prop', () => { const wrapper = mount(Button, { - propsData: { + props: { icon: 'success', iconPrefix: 'my-icon', }, @@ -53,7 +53,7 @@ test('should change icon class prefix when using icon-prefix prop', () => { test('should render loading slot and match snapshot', () => { const wrapper = mount(Button, { - propsData: { + props: { loading: true, }, slots: { @@ -66,7 +66,7 @@ test('should render loading slot and match snapshot', () => { test('should render loading of a specific size when using loading-size prop', () => { const wrapper = mount(Button, { - propsData: { + props: { loading: true, loadingSize: '10px', }, @@ -79,7 +79,7 @@ test('should render loading of a specific size when using loading-size prop', () test('should render icon in the right side when setting icon-position to right', () => { const wrapper = mount(Button, { - propsData: { + props: { icon: 'plus', iconPosition: 'right', }, diff --git a/src/calendar/test/index.legacy.js b/src/calendar/test/index.legacy.js index f885ba092..3c4b0727b 100644 --- a/src/calendar/test/index.legacy.js +++ b/src/calendar/test/index.legacy.js @@ -12,7 +12,7 @@ import { test('select event when type is single', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -28,7 +28,7 @@ test('select event when type is single', async () => { test('select event when type is range', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -54,7 +54,7 @@ test('select event when type is range', async () => { test('select event when type is multiple', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'multiple', minDate, maxDate, @@ -89,7 +89,7 @@ test('select event when type is multiple', async () => { test('select event when type is multiple', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'multiple', minDate, maxDate, @@ -110,7 +110,7 @@ test('select event when type is multiple', async () => { test('should not trigger select event when click disabled day', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -126,7 +126,7 @@ test('should not trigger select event when click disabled day', async () => { test('confirm event when type is single', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -145,7 +145,7 @@ test('confirm event when type is single', async () => { test('confirm event when type is range', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -169,7 +169,7 @@ test('confirm event when type is range', async () => { test('default single date', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { poppable: false, }, }); @@ -182,7 +182,7 @@ test('default single date', async () => { test('default range date', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', poppable: false, }, @@ -198,7 +198,7 @@ test('default range date', async () => { test('reset method', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, type: 'range', @@ -223,7 +223,7 @@ test('reset method', async () => { test('set show-confirm to false', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, type: 'range', @@ -245,7 +245,7 @@ test('set show-confirm to false', async () => { test('row-height prop', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -261,7 +261,7 @@ test('row-height prop', async () => { test('formatter prop', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -296,7 +296,7 @@ test('formatter prop', async () => { test('title & footer slot', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -315,7 +315,7 @@ test('title & footer slot', async () => { test('should reset when type changed', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -340,7 +340,7 @@ test('should reset when type changed', async () => { test('default-date prop in single type', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, defaultDate: getNextDay(minDate), @@ -360,7 +360,7 @@ test('default-date prop in single type', async () => { test('default-date prop in range type', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -385,7 +385,7 @@ test('default-date prop in range type', async () => { test('popup wrapper', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, defaultDate: minDate, @@ -411,7 +411,7 @@ test('popup wrapper', async () => { test('set show-mark prop to false', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, showMark: false, @@ -426,7 +426,7 @@ test('set show-mark prop to false', async () => { test('color prop when type is single', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, color: 'blue', @@ -442,7 +442,7 @@ test('color prop when type is single', async () => { test('color prop when type is range', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { defaultDate: [minDate, maxDate], type: 'range', minDate, @@ -459,7 +459,7 @@ test('color prop when type is range', async () => { test('close event', () => { const wrapper = mount(Calendar, { - propsData: { + props: { value: true, }, }); diff --git a/src/calendar/test/prop.legacy.js b/src/calendar/test/prop.legacy.js index 6d3f177d0..b1b420da3 100644 --- a/src/calendar/test/prop.legacy.js +++ b/src/calendar/test/prop.legacy.js @@ -4,7 +4,7 @@ import { minDate, maxDate, formatRange, formatDate } from './utils'; test('max-range prop when type is range and showConfirm is false', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -29,7 +29,7 @@ test('max-range prop when type is range and showConfirm is false', async () => { test('max-range prop when type is range and showConfirm is true', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -53,7 +53,7 @@ test('max-range prop when type is range and showConfirm is true', async () => { test('max-range prop when type is multiple', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'multiple', minDate, maxDate, @@ -74,7 +74,7 @@ test('max-range prop when type is multiple', async () => { test('show-title prop', () => { const wrapper = mount(Calendar, { - propsData: { + props: { value: true, }, }); @@ -86,7 +86,7 @@ test('show-title prop', () => { test('show-subtitle prop', () => { const wrapper = mount(Calendar, { - propsData: { + props: { value: true, }, }); @@ -98,7 +98,7 @@ test('show-subtitle prop', () => { test('hide close icon when there is no title', () => { const wrapper = mount(Calendar, { - propsData: { + props: { value: true, }, }); @@ -115,7 +115,7 @@ test('hide close icon when there is no title', () => { test('allow-same-day prop', async () => { const select = jest.fn(); const wrapper = mount(Calendar, { - propsData: { + props: { type: 'range', minDate, maxDate, @@ -144,7 +144,7 @@ test('allow-same-day prop', async () => { test('min-date after current time', () => { const wrapper = mount(Calendar, { - propsData: { + props: { poppable: false, minDate: new Date(2200, 0, 1), maxDate: new Date(2200, 0, 2), @@ -157,7 +157,7 @@ test('min-date after current time', () => { test('min-date before current time', () => { const wrapper = mount(Calendar, { - propsData: { + props: { poppable: false, minDate: new Date(1800, 0, 1), maxDate: new Date(1800, 0, 2), @@ -170,7 +170,7 @@ test('min-date before current time', () => { test('lazy-render prop', () => { const wrapper = mount(Calendar, { - propsData: { + props: { minDate, maxDate, poppable: false, @@ -183,7 +183,7 @@ test('lazy-render prop', () => { test('month-show event', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { value: true, }, }); @@ -194,7 +194,7 @@ test('month-show event', async () => { test('first day of week', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { poppable: false, defaultDate: new Date(2020, 7, 1), minDate: new Date(2020, 7, 1), @@ -216,7 +216,7 @@ test('first day of week', async () => { test('readonly prop', async () => { const wrapper = mount(Calendar, { - propsData: { + props: { type: 'multiple', minDate, maxDate, diff --git a/src/card/test/index.legacy.js b/src/card/test/index.legacy.js index 7fd5410e0..c8c04f0ce 100644 --- a/src/card/test/index.legacy.js +++ b/src/card/test/index.legacy.js @@ -23,7 +23,7 @@ test('click event', () => { test('click-thumb event', () => { const onClickThumb = jest.fn(); const wrapper = mount(Card, { - propsData: { + props: { thumb: 'xx', }, context: { diff --git a/src/cell/test/index.legacy.js b/src/cell/test/index.legacy.js index 2f639b3ce..20ff9875b 100644 --- a/src/cell/test/index.legacy.js +++ b/src/cell/test/index.legacy.js @@ -18,7 +18,7 @@ test('click event', () => { test('arrow direction', () => { const wrapper = mount(Cell, { - propsData: { + props: { isLink: true, arrowDirection: 'down', }, @@ -47,7 +47,7 @@ test('render slot', () => { test('title-style prop', () => { const wrapper = mount(Cell, { - propsData: { + props: { title: 'title', titleStyle: { color: 'red', @@ -70,7 +70,7 @@ test('CellGroup title slot', () => { test('icon-prefix prop', () => { const wrapper = mount(Cell, { - propsData: { + props: { iconPrefix: 'my-icon', icon: 'success', }, diff --git a/src/checkbox/test/index.legacy.js b/src/checkbox/test/index.legacy.js index 77af1629f..33e475eeb 100644 --- a/src/checkbox/test/index.legacy.js +++ b/src/checkbox/test/index.legacy.js @@ -19,7 +19,7 @@ test('switch checkbox', async () => { test('disabled', () => { const wrapper = mount(Checkbox, { - propsData: { + props: { disabled: true, }, }); @@ -33,7 +33,7 @@ test('label disabled', () => { scopedSlots: { default: () => 'Label', }, - propsData: { + props: { labelDisabled: true, }, }); @@ -96,7 +96,7 @@ test('label-position prop', () => { scopedSlots: { default: () => 'Label', }, - propsData: { + props: { labelPosition: 'left', }, }); diff --git a/src/circle/test/index.legacy.js b/src/circle/test/index.legacy.js index a598bf044..e4f904b54 100644 --- a/src/circle/test/index.legacy.js +++ b/src/circle/test/index.legacy.js @@ -4,7 +4,7 @@ import { mount, later } from '../../../test'; test('speed is 0', async () => { const wrapper = mount(Circle, { - propsData: { + props: { rate: 50, value: 0, }, @@ -24,7 +24,7 @@ test('speed is 0', async () => { test('animate', async () => { const onInput = jest.fn(); mount(Circle, { - propsData: { + props: { rate: 50, speed: 100, }, @@ -40,7 +40,7 @@ test('animate', async () => { test('size prop', () => { const wrapper = mount(Circle, { - propsData: { + props: { size: 100, }, }); @@ -50,7 +50,7 @@ test('size prop', () => { test('stroke-linecap prop', () => { const wrapper = mount(Circle, { - propsData: { + props: { strokeLinecap: 'square', }, }); diff --git a/src/collapse/test/index.legacy.js b/src/collapse/test/index.legacy.js index f18226ad6..3903cd42b 100644 --- a/src/collapse/test/index.legacy.js +++ b/src/collapse/test/index.legacy.js @@ -44,7 +44,7 @@ test('basic mode', async () => { test('accordion', async () => { const wrapper = mount(component, { - propsData: { + props: { accordion: true, }, }); @@ -88,7 +88,7 @@ test('render collapse-item slot', () => { test('disable border', () => { const wrapper = mount(component, { - propsData: { + props: { border: false, }, }); diff --git a/src/contact-card/test/index.legacy.js b/src/contact-card/test/index.legacy.js index 76ad44a38..bc77c5561 100644 --- a/src/contact-card/test/index.legacy.js +++ b/src/contact-card/test/index.legacy.js @@ -18,7 +18,7 @@ test('should emit click event after clicking the ContactCard', () => { test('should not emit click event after clicking the uneditable ContactCard', () => { const click = jest.fn(); const wrapper = mount(ContactCard, { - propsData: { + props: { editable: false, }, context: { diff --git a/src/contact-edit/test/index.legacy.js b/src/contact-edit/test/index.legacy.js index 150ba2723..77677911f 100644 --- a/src/contact-edit/test/index.legacy.js +++ b/src/contact-edit/test/index.legacy.js @@ -8,7 +8,7 @@ const contactInfo = { const createComponent = () => { const wrapper = mount(ContactEdit, { - propsData: { + props: { contactInfo, }, }); @@ -61,7 +61,7 @@ test('should watch contact info', () => { test('should allow deleting contact', async () => { const wrapper = mount(ContactEdit, { - propsData: { + props: { isEdit: true, }, }); diff --git a/src/contact-list/test/index.legacy.js b/src/contact-list/test/index.legacy.js index 63b1c3268..5c6e7681e 100644 --- a/src/contact-list/test/index.legacy.js +++ b/src/contact-list/test/index.legacy.js @@ -8,7 +8,7 @@ const contactInfo = { test('should render ContactList correctly', () => { const wrapper = mount(ContactList, { - propsData: { + props: { list: [contactInfo], }, }); @@ -18,7 +18,7 @@ test('should render ContactList correctly', () => { test('should emit select event after clicking the radio', () => { const onSelect = jest.fn(); const wrapper = mount(ContactList, { - propsData: { + props: { list: [contactInfo], }, context: { diff --git a/src/count-down/test/index.legacy.js b/src/count-down/test/index.legacy.js index d1cf1f7d7..3a3973b5f 100644 --- a/src/count-down/test/index.legacy.js +++ b/src/count-down/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, later } from '../../../test'; test('macro task finish event', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1, }, }); @@ -15,7 +15,7 @@ test('macro task finish event', async () => { test('micro task finish event', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1, millisecond: true, }, @@ -28,7 +28,7 @@ test('micro task finish event', async () => { test('macro task re-render', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1000, format: 'SSS', }, @@ -43,7 +43,7 @@ test('macro task re-render', async () => { test('micro task re-render', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 100, format: 'SSS', millisecond: true, @@ -59,7 +59,7 @@ test('micro task re-render', async () => { test('disable auto-start prop', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 100, format: 'SSS', autoStart: false, @@ -72,7 +72,7 @@ test('disable auto-start prop', async () => { test('start method', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 100, format: 'SSS', autoStart: false, @@ -94,7 +94,7 @@ test('start method', async () => { test('pause method', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 100, format: 'SSS', millisecond: true, @@ -111,7 +111,7 @@ test('pause method', async () => { test('reset method', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 100, format: 'SSS', millisecond: true, @@ -128,7 +128,7 @@ test('reset method', async () => { test('complete format prop', () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 30 * 60 * 60 * 1000 - 1, autoStart: false, format: 'DD-HH-mm-ss-SSS', @@ -140,7 +140,7 @@ test('complete format prop', () => { test('milliseconds format SS', () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1500, autoStart: false, format: 'ss-SS', @@ -152,7 +152,7 @@ test('milliseconds format SS', () => { test('milliseconds format S', () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1500, autoStart: false, format: 'ss-S', @@ -164,7 +164,7 @@ test('milliseconds format S', () => { test('incomplate format prop', () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 30 * 60 * 60 * 1000 - 1, autoStart: false, format: 'HH-mm-ss-SSS', @@ -216,7 +216,7 @@ test('pause when deactivated', async () => { test('change event', async () => { const wrapper = mount(CountDown, { - propsData: { + props: { time: 1, }, }); diff --git a/src/coupon-list/test/index.legacy.js b/src/coupon-list/test/index.legacy.js index 5233a6f3d..7a9a70928 100644 --- a/src/coupon-list/test/index.legacy.js +++ b/src/coupon-list/test/index.legacy.js @@ -76,7 +76,7 @@ const disabledDiscountCoupon = { test('render disabled coupon', () => { const wrapper = mount(Coupon, { - propsData: { + props: { coupon: disabledCoupon, disabled: true, }, @@ -87,7 +87,7 @@ test('render disabled coupon', () => { test('render coupon list', async () => { const wrapper = mount(CouponList, { - propsData: { + props: { chosenCoupon: 1, coupons: [ emptyCoupon, @@ -106,7 +106,7 @@ test('render coupon list', async () => { test('render empty coupon list', () => { const wrapper = mount(CouponList, { - propsData: { + props: { coupons: [], disabledCoupons: [], }, @@ -117,7 +117,7 @@ test('render empty coupon list', () => { test('empty-image prop', () => { const wrapper = mount(CouponList, { - propsData: { + props: { emptyImage: 'https://img.yzcdn.com/xxx.png', }, }); @@ -161,7 +161,7 @@ test('render coupon cell', () => { test('render coupon cell with coupon', () => { const wrapper = mount(CouponCell, { - propsData: { + props: { coupons: [{ value: 100 }], chosenCoupon: 0, }, @@ -171,7 +171,7 @@ test('render coupon cell with coupon', () => { test('render coupon cell with zero discount', () => { const wrapper = mount(CouponCell, { - propsData: { + props: { coupons: [{ ...coupon4, value: 0, denominations: 150 }], chosenCoupon: 0, }, diff --git a/src/datetime-picker/test/date-picker.legacy.js b/src/datetime-picker/test/date-picker.legacy.js index c2bb31d01..ae0508025 100644 --- a/src/datetime-picker/test/date-picker.legacy.js +++ b/src/datetime-picker/test/date-picker.legacy.js @@ -12,7 +12,7 @@ function formatter(type, value) { test('filter prop', () => { const wrapper = mount(DatePicker, { - propsData: { + props: { filter, minDate: new Date(2020, 0, 1), maxDate: new Date(2025, 10, 1), @@ -25,7 +25,7 @@ test('filter prop', () => { test('formatter prop', async () => { const wrapper = mount(DatePicker, { - propsData: { + props: { filter, formatter, minDate: new Date(2010, 0, 1), @@ -53,7 +53,7 @@ test('confirm event', () => { const date = new Date(2020, 10, 1, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { value: date, minDate: new Date(2020, 0, 1), maxDate: new Date(2025, 10, 1), @@ -72,7 +72,7 @@ test('year-month type', () => { const date = new Date(2020, 10, 1, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { type: 'year-month', value: date, minDate: new Date(2020, 0, 1), @@ -99,7 +99,7 @@ test('month-day type', () => { const date = new Date(2020, 10, 1, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { type: 'month-day', value: date, minDate: new Date(2020, 0, 1), @@ -124,7 +124,7 @@ test('month-day type', () => { test('datehour type', async () => { const wrapper = mount(DatePicker, { - propsData: { + props: { minDate: new Date(2010, 0, 1), maxDate: new Date(2025, 10, 1), value: new Date(2020, 10, 1, 0, 0), @@ -149,7 +149,7 @@ test('cancel event', () => { test('max-date prop', () => { const maxDate = new Date(2010, 5, 0, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { value: new Date(2020, 10, 30, 30, 30), maxDate, }, @@ -162,7 +162,7 @@ test('max-date prop', () => { test('min-date prop', () => { const minDate = new Date(2030, 0, 0, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { value: new Date(2020, 0, 0, 0, 0), minDate, }, @@ -174,7 +174,7 @@ test('min-date prop', () => { test('dynamic set value', () => { const wrapper = mount(DatePicker, { - propsData: { + props: { value: new Date(2019, 1, 1), }, }); @@ -193,7 +193,7 @@ test('use min-date with filter', async () => { const maxDate = new Date(2040, 0, 0, 0, 0); const wrapper = mount(DatePicker, { - propsData: { + props: { minDate, maxDate, value: new Date(2020, 0, 0, 0, 0), diff --git a/src/datetime-picker/test/datetime-picker.legacy.js b/src/datetime-picker/test/datetime-picker.legacy.js index d23770d31..82f1ddfbc 100644 --- a/src/datetime-picker/test/datetime-picker.legacy.js +++ b/src/datetime-picker/test/datetime-picker.legacy.js @@ -21,7 +21,7 @@ test('confirm & cancel event', () => { test('time type', () => { const wrapper = mount(DatetimePicker, { - propsData: { + props: { type: 'time', minHour: 22, minMinute: 58, diff --git a/src/datetime-picker/test/time-picker.legacy.js b/src/datetime-picker/test/time-picker.legacy.js index 387eef48e..687e2e1ce 100644 --- a/src/datetime-picker/test/time-picker.legacy.js +++ b/src/datetime-picker/test/time-picker.legacy.js @@ -12,7 +12,7 @@ function formatter(type, value) { test('format initial value', () => { const wrapper = mount(TimePicker, { - propsData: { + props: { minHour: 22, minMinute: 58, }, @@ -23,7 +23,7 @@ test('format initial value', () => { test('max-hour & max-minute', () => { const wrapper = mount(TimePicker, { - propsData: { + props: { value: '23:59', maxHour: 2, maxMinute: 2, @@ -35,7 +35,7 @@ test('max-hour & max-minute', () => { test('filter prop', () => { const wrapper = mount(TimePicker, { - propsData: { + props: { filter, value: '12:00', }, @@ -46,7 +46,7 @@ test('filter prop', () => { test('formatter prop', async () => { const wrapper = mount(TimePicker, { - propsData: { + props: { filter, formatter, value: '12:00', @@ -67,7 +67,7 @@ test('formatter prop', async () => { test('confirm event', () => { const wrapper = mount(TimePicker, { - propsData: { + props: { value: '12:00', }, }); @@ -98,7 +98,7 @@ test('dynamic set value', () => { test('change min-minute and emit correct value', async () => { const wrapper = mount(TimePicker, { - propsData: { + props: { value: '12:00', minMinute: 0, }, @@ -113,7 +113,7 @@ test('change min-minute and emit correct value', async () => { test('set max-hour & max-minute smaller than current then emit correct value', async () => { const wrapper = mount(TimePicker, { - propsData: { + props: { value: '23:59', }, }); diff --git a/src/dialog/test/index.legacy.js b/src/dialog/test/index.legacy.js index 8b128bb3e..eae15fa13 100644 --- a/src/dialog/test/index.legacy.js +++ b/src/dialog/test/index.legacy.js @@ -34,7 +34,7 @@ test('Dialog function call', async () => { test('before close', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, showCancelButton: true, closeOnClickOverlay: true, @@ -77,7 +77,7 @@ test('register component', () => { test('button color', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, showCancelButton: true, cancelButtonColor: 'white', @@ -89,7 +89,7 @@ test('button color', () => { test('button text', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, showCancelButton: true, cancelButtonText: 'Custom cancel', @@ -105,7 +105,7 @@ test('dialog component', () => { test('default slot', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, }, scopedSlots: { @@ -117,7 +117,7 @@ test('default slot', () => { test('title slot', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, }, scopedSlots: { @@ -129,7 +129,7 @@ test('title slot', () => { test('allow-html prop', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, message: 'text', allowHtml: false, @@ -148,7 +148,7 @@ test('open & close event', () => { test('width prop', () => { const wrapper = mount(DialogComponent, { - propsData: { + props: { value: true, width: 200, }, diff --git a/src/empty/test/index.legacy.js b/src/empty/test/index.legacy.js index ea4756181..2d22e1e65 100644 --- a/src/empty/test/index.legacy.js +++ b/src/empty/test/index.legacy.js @@ -33,7 +33,7 @@ test('bottom slot', () => { test('render svg when image is network', () => { const wrapper = mount(Empty, { - propsData: { + props: { image: 'network', }, }); @@ -43,7 +43,7 @@ test('render svg when image is network', () => { test('image-size prop', () => { const wrapper = mount(Empty, { - propsData: { + props: { imageSize: 50, }, }); diff --git a/src/field/test/index.legacy.js b/src/field/test/index.legacy.js index a4f9c6b87..497b65cfc 100644 --- a/src/field/test/index.legacy.js +++ b/src/field/test/index.legacy.js @@ -37,7 +37,7 @@ test('click-input event when using input slot', () => { test('click-icon event', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'a', leftIcon: 'contact', rightIcon: 'search', @@ -53,7 +53,7 @@ test('click-icon event', () => { test('number type', () => { const wrapper = mount(Field, { - propsData: { + props: { value: '', type: 'number', }, @@ -76,7 +76,7 @@ test('number type', () => { test('digit type', () => { const wrapper = mount(Field, { - propsData: { + props: { value: '', type: 'digit', }, @@ -99,7 +99,7 @@ test('digit type', () => { test('render textarea', async () => { const wrapper = mount(Field, { - propsData: { + props: { type: 'textarea', autosize: true, }, @@ -111,7 +111,7 @@ test('render textarea', async () => { test('autosize textarea field', () => { const wrapper = mount(Field, { - propsData: { + props: { type: 'textarea', autosize: {}, }, @@ -126,7 +126,7 @@ test('autosize textarea field', () => { test('autosize object', async () => { const wrapper = mount(Field, { - propsData: { + props: { type: 'textarea', autosize: { maxHeight: 100, @@ -167,7 +167,7 @@ test('maxlength', async () => { attrs: { maxlength: 3, }, - propsData: { + props: { value: 1234, type: 'number', }, @@ -194,7 +194,7 @@ test('maxlength', async () => { test('clearable prop', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'test', clearable: true, }, @@ -212,7 +212,7 @@ test('clearable prop', () => { test('clear-trigger prop', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'test', clearable: true, clearTrigger: 'always', @@ -254,7 +254,7 @@ test('render extra slot', () => { test('size prop', () => { const wrapper = mount(Field, { - propsData: { + props: { size: 'large', }, }); @@ -263,7 +263,7 @@ test('size prop', () => { test('label-width prop with unit', () => { const wrapper = mount(Field, { - propsData: { + props: { label: 'Label', labelWidth: '10rem', }, @@ -273,7 +273,7 @@ test('label-width prop with unit', () => { test('label-width prop without unit', () => { const wrapper = mount(Field, { - propsData: { + props: { label: 'Label', labelWidth: 100, }, @@ -283,7 +283,7 @@ test('label-width prop without unit', () => { test('label-class prop', () => { const wrapper = mount(Field, { - propsData: { + props: { label: 'Label', labelClass: 'custom-label-class', }, @@ -293,7 +293,7 @@ test('label-class prop', () => { test('arrow-direction prop', () => { const wrapper = mount(Field, { - propsData: { + props: { isLink: true, arrowDirection: 'up', }, @@ -303,7 +303,7 @@ test('arrow-direction prop', () => { test('formatter prop', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'abc123', formatter: (value) => value.replace(/\d/g, ''), }, @@ -319,7 +319,7 @@ test('formatter prop', () => { test('format-trigger prop', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'abc123', formatTrigger: 'onBlur', formatter: (value) => value.replace(/\d/g, ''), @@ -342,7 +342,7 @@ test('format-trigger prop', () => { test('reach max word-limit', () => { const wrapper = mount(Field, { - propsData: { + props: { value: 'foo', maxlength: 3, showWordLimit: true, @@ -353,7 +353,7 @@ test('reach max word-limit', () => { test('reach max word-limit undefined', () => { const wrapper = mount(Field, { - propsData: { + props: { value: undefined, maxlength: 3, showWordLimit: true, @@ -364,7 +364,7 @@ test('reach max word-limit undefined', () => { test('reach max word-limit null', () => { const wrapper = mount(Field, { - propsData: { + props: { value: null, maxlength: 3, showWordLimit: true, @@ -375,7 +375,7 @@ test('reach max word-limit null', () => { test('name prop', () => { const wrapper = mount(Field, { - propsData: { + props: { name: 'foo', }, }); @@ -398,7 +398,7 @@ test('destroy field', () => { test('colon prop', () => { const wrapper = mount(Field, { - propsData: { + props: { label: 'foo', colon: true, }, @@ -426,7 +426,7 @@ test('should blur search input on enter', () => { test('value is null', () => { const wrapper = mount(Field, { - propsData: { + props: { value: null, }, }); diff --git a/src/icon/test/index.legacy.js b/src/icon/test/index.legacy.js index 3e7bb582d..bdffd2d0c 100644 --- a/src/icon/test/index.legacy.js +++ b/src/icon/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount } from '@vue/test-utils'; test('render icon with builtin icon name', () => { const wrapper = mount(Icon, { - propsData: { + props: { name: 'success', }, }); @@ -12,7 +12,7 @@ test('render icon with builtin icon name', () => { test('render icon with url name', () => { const wrapper = mount(Icon, { - propsData: { + props: { name: 'https://img.yzcdn.com/icon.jpg', }, }); @@ -21,7 +21,7 @@ test('render icon with url name', () => { test('render icon with local image', () => { const wrapper = mount(Icon, { - propsData: { + props: { name: '/assets/icon.jpg', }, }); @@ -39,7 +39,7 @@ test('render icon default slot', () => { test('tag prop', () => { const wrapper = mount(Icon, { - propsData: { + props: { tag: 'div', }, }); @@ -48,7 +48,7 @@ test('tag prop', () => { test('dot prop', () => { const wrapper = mount(Icon, { - propsData: { + props: { dot: true, }, }); @@ -57,7 +57,7 @@ test('dot prop', () => { test('size without unit', () => { const wrapper = mount(Icon, { - propsData: { + props: { size: 20, }, }); diff --git a/src/image-preview/test/index.legacy.js b/src/image-preview/test/index.legacy.js index 12103af34..6d846255d 100644 --- a/src/image-preview/test/index.legacy.js +++ b/src/image-preview/test/index.legacy.js @@ -39,7 +39,7 @@ const images = [ test('render image', async () => { const wrapper = mount(ImagePreviewVue, { - propsData: { images, value: true }, + props: { images, value: true }, }); expect(wrapper.html()).toMatchSnapshot(); @@ -58,7 +58,7 @@ test('render image', async () => { test('closeable prop', () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { images, value: true, closeable: true, @@ -71,7 +71,7 @@ test('closeable prop', () => { test('close-icon prop', () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { value: true, closeable: true, closeIcon: 'close', @@ -83,7 +83,7 @@ test('close-icon prop', () => { test('close-icon-position prop', () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { value: true, closeable: true, closeIcon: 'close', @@ -96,7 +96,7 @@ test('close-icon-position prop', () => { test('async close prop', async () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { images, value: true, asyncClose: true, @@ -137,7 +137,7 @@ test('function call', (done) => { test('double click', async () => { const onScale = jest.fn(); const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { images, value: true, }, @@ -222,7 +222,7 @@ test('zoom in and drag image to move', async () => { const restore = mockGetBoundingClientRect({ width: 100, height: 100 }); const wrapper = mount(ImagePreviewVue, { - propsData: { images, value: true }, + props: { images, value: true }, }); await later(); @@ -251,7 +251,7 @@ test('zoom out', async () => { const onScale = jest.fn(); const wrapper = mount(ImagePreviewVue, { - propsData: { images, value: true }, + props: { images, value: true }, listeners: { scale: onScale, }, @@ -268,7 +268,7 @@ test('zoom out', async () => { test('set show-index prop to false', () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { value: true, showIndex: false, }, @@ -303,7 +303,7 @@ test('cover slot', () => { test('closeOnPopstate', () => { const wrapper = mount(ImagePreviewVue, { - propsData: { + props: { images, value: true, closeOnPopstate: true, diff --git a/src/image/test/index.legacy.js b/src/image/test/index.legacy.js index f09888e94..66d349b66 100644 --- a/src/image/test/index.legacy.js +++ b/src/image/test/index.legacy.js @@ -11,7 +11,7 @@ test('click event', () => { test('load event', () => { const wrapper = mount(VanImage, { - propsData: { + props: { src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, }); @@ -27,7 +27,7 @@ test('load event', () => { test('error event', () => { const wrapper = mount(VanImage, { - propsData: { + props: { src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, }); @@ -39,7 +39,7 @@ test('error event', () => { test('lazy load', () => { const wrapper = mount(VanImage, { - propsData: { + props: { src: 'https://img.yzcdn.cn/vant/cat.jpeg', lazyLoad: true, }, @@ -50,7 +50,7 @@ test('lazy load', () => { test('lazy-load load event', (done) => { const wrapper = mount(VanImage, { - propsData: { + props: { lazyLoad: true, src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, @@ -77,7 +77,7 @@ test('lazy-load load event', (done) => { test('lazy-load error event', (done) => { const wrapper = mount(VanImage, { - propsData: { + props: { lazyLoad: true, }, mocks: { @@ -103,7 +103,7 @@ test('lazy-load error event', (done) => { test('show-loading prop', () => { const wrapper = mount(VanImage, { - propsData: { + props: { showLoading: false, }, }); @@ -113,7 +113,7 @@ test('show-loading prop', () => { test('show-error prop', () => { const wrapper = mount(VanImage, { - propsData: { + props: { showError: false, src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, @@ -126,7 +126,7 @@ test('show-error prop', () => { test('error-icon prop', () => { const wrapper = mount(VanImage, { - propsData: { + props: { errorIcon: 'error', src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, @@ -139,7 +139,7 @@ test('error-icon prop', () => { test('loading-icon prop', () => { const wrapper = mount(VanImage, { - propsData: { + props: { loadingIcon: 'success', }, }); @@ -149,7 +149,7 @@ test('loading-icon prop', () => { test('apply icon-prefix prop to error-icon', () => { const wrapper = mount(VanImage, { - propsData: { + props: { errorIcon: 'error', iconPrefix: 'my-icon', src: 'https://img.yzcdn.cn/vant/cat.jpeg', @@ -163,7 +163,7 @@ test('apply icon-prefix prop to error-icon', () => { test('apply icon-prefix prop to loading-icon', () => { const wrapper = mount(VanImage, { - propsData: { + props: { loadingIcon: 'success', iconPrefix: 'my-icon', }, @@ -174,7 +174,7 @@ test('apply icon-prefix prop to loading-icon', () => { test('radius prop', () => { const wrapper = mount(VanImage, { - propsData: { + props: { radius: 3, src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, @@ -185,7 +185,7 @@ test('radius prop', () => { test('default slot', () => { const wrapper = mount(VanImage, { - propsData: { + props: { src: 'https://img.yzcdn.cn/vant/cat.jpeg', }, scopedSlots: { diff --git a/src/list/test/index.legacy.js b/src/list/test/index.legacy.js index df55978dc..0a2982fd7 100644 --- a/src/list/test/index.legacy.js +++ b/src/list/test/index.legacy.js @@ -21,7 +21,7 @@ test('load event', async () => { test('error loaded, click error-text and reload', async () => { const wrapper = mount(List, { - propsData: { + props: { errorText: 'Request failed. Click to reload...', error: true, }, @@ -52,7 +52,7 @@ test('error loaded, click error-text and reload', async () => { test('finished', async () => { const wrapper = mount(List, { - propsData: { + props: { finished: true, finishedText: 'Finished', }, @@ -72,7 +72,7 @@ test('finished', async () => { test('finished slot', async () => { const wrapper = mount(List, { - propsData: { + props: { finished: true, }, scopedSlots: { @@ -85,7 +85,7 @@ test('finished slot', async () => { test('error slot', async () => { const wrapper = mount(List, { - propsData: { + props: { error: true, }, scopedSlots: { @@ -98,7 +98,7 @@ test('error slot', async () => { test('immediate check false', async () => { const wrapper = mount(List, { - propsData: { + props: { immediateCheck: false, }, }); @@ -139,7 +139,7 @@ test('check the direction props', () => { slots: { default: '
list item
', }, - propsData: { + props: { direction: 'up', }, }); diff --git a/src/loading/test/index.legacy.js b/src/loading/test/index.legacy.js index 4db526d66..4543ed68e 100644 --- a/src/loading/test/index.legacy.js +++ b/src/loading/test/index.legacy.js @@ -3,7 +3,7 @@ import Loading from '..'; test('size prop', () => { const wrapper = mount(Loading, { - propsData: { + props: { size: 20, }, }); @@ -13,7 +13,7 @@ test('size prop', () => { test('text-size prop', () => { const wrapper = mount(Loading, { - propsData: { + props: { textSize: 20, }, scopedSlots: { diff --git a/src/nav-bar/test/index.legacy.js b/src/nav-bar/test/index.legacy.js index 0bacc7f91..1f80a87cf 100644 --- a/src/nav-bar/test/index.legacy.js +++ b/src/nav-bar/test/index.legacy.js @@ -26,7 +26,7 @@ test('should render placeholder element when using placeholder prop', () => { const restore = mockGetBoundingClientRect({ height: 50 }); const wrapper = mount(NavBar, { - propsData: { + props: { fixed: true, placeholder: true, }, @@ -39,7 +39,7 @@ test('should render placeholder element when using placeholder prop', () => { test('should emit click-left event when clicking left text', () => { const wrapper = mount(NavBar, { - propsData: { + props: { leftText: 'left', }, }); @@ -50,7 +50,7 @@ test('should emit click-left event when clicking left text', () => { test('should emit click-right event when clicking right text', () => { const wrapper = mount(NavBar, { - propsData: { + props: { rightText: 'right', }, }); @@ -61,7 +61,7 @@ test('should emit click-right event when clicking right text', () => { test('should have safe-area-inset-top class when using safe-area-inset-top prop', () => { const wrapper = mount(NavBar, { - propsData: { + props: { safeAreaInsetTop: true, }, }); diff --git a/src/notice-bar/test/index.legacy.js b/src/notice-bar/test/index.legacy.js index 318c23ecb..1ade0954b 100644 --- a/src/notice-bar/test/index.legacy.js +++ b/src/notice-bar/test/index.legacy.js @@ -10,7 +10,7 @@ test('click event', () => { test('close event', () => { const wrapper = mount(NoticeBar, { - propsData: { + props: { mode: 'closeable', }, }); @@ -39,7 +39,7 @@ test('icon slot', () => { test('replay event', async () => { const wrapper = mount(NoticeBar, { - propsData: { + props: { text: 'foo', }, }); @@ -51,7 +51,7 @@ test('replay event', async () => { test('should scroll when content width > wrap width ', async () => { const wrapper = mount(NoticeBar, { - propsData: { + props: { text: 'foo', delay: 0, }, @@ -74,7 +74,7 @@ test('should scroll when content width > wrap width ', async () => { test('should not scroll when content width > wrap width ', async () => { const wrapper = mount(NoticeBar, { - propsData: { + props: { text: 'foo', delay: 0, }, diff --git a/src/number-keyboard/test/index.legacy.js b/src/number-keyboard/test/index.legacy.js index e2eba7c63..154dcf037 100644 --- a/src/number-keyboard/test/index.legacy.js +++ b/src/number-keyboard/test/index.legacy.js @@ -8,7 +8,7 @@ function clickKey(key) { test('click number key', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { theme: 'custom', closeButtonText: 'close', }, @@ -40,7 +40,7 @@ test('click collapse key', () => { test('click close button', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { theme: 'custom', closeButtonText: 'close', }, @@ -62,7 +62,7 @@ test('listen to show/hide event when has transtion', () => { test('listen to show event when no transtion', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { transition: false, }, }); @@ -74,7 +74,7 @@ test('listen to show event when no transtion', () => { test('render title', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { title: 'Title', closeButtonText: 'Close', }, @@ -95,7 +95,7 @@ test('title-left slot', () => { test('extra-key prop', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { extraKey: 'foo', }, }); @@ -115,7 +115,7 @@ test('extra-key slot', () => { test('hideOnClickOutside', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { show: true, }, }); @@ -126,7 +126,7 @@ test('hideOnClickOutside', () => { test('disable hideOnClickOutside', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { show: true, hideOnClickOutside: false, }, @@ -162,7 +162,7 @@ test('move and blur key', () => { test('bind value', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { value: '', }, listeners: { @@ -185,7 +185,7 @@ test('bind value', () => { test('maxlength', () => { const onInput = jest.fn(); const wrapper = mount(NumberKeyboard, { - propsData: { + props: { value: '', maxlength: 1, }, @@ -207,7 +207,7 @@ test('maxlength', () => { test('show-delete-key prop', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { showDeleteKey: true, }, }); @@ -229,7 +229,7 @@ test('show-delete-key prop', () => { test('close-button-loading prop', () => { const wrapper = mount(NumberKeyboard, { - propsData: { + props: { show: true, theme: 'custom', closeButtonLoading: true, diff --git a/src/overlay/test/index.legacy.js b/src/overlay/test/index.legacy.js index f1d498c05..4264a7a71 100644 --- a/src/overlay/test/index.legacy.js +++ b/src/overlay/test/index.legacy.js @@ -3,7 +3,7 @@ import Overlay from '..'; test('z-index prop', () => { const wrapper = mount(Overlay, { - propsData: { + props: { show: true, zIndex: 99, }, @@ -14,7 +14,7 @@ test('z-index prop', () => { test('class-name prop', () => { const wrapper = mount(Overlay, { - propsData: { + props: { show: true, className: 'my-overlay', }, @@ -25,7 +25,7 @@ test('class-name prop', () => { test('custom style prop', () => { const wrapper = mount(Overlay, { - propsData: { + props: { show: true, customStyle: { backgroundColor: 'red', @@ -38,7 +38,7 @@ test('custom style prop', () => { test('duration prop', () => { const wrapper = mount(Overlay, { - propsData: { + props: { show: true, duration: 1, }, diff --git a/src/pagination/test/index.legacy.js b/src/pagination/test/index.legacy.js index 5b587318a..90e782c6b 100644 --- a/src/pagination/test/index.legacy.js +++ b/src/pagination/test/index.legacy.js @@ -3,7 +3,7 @@ import Paginaion from '..'; test('render prev-text & next-text slot', () => { const wrapper = mount(Paginaion, { - propsData: { + props: { totalItems: 50, showPageSize: 5, }, @@ -18,7 +18,7 @@ test('render prev-text & next-text slot', () => { test('render page slot', () => { const wrapper = mount(Paginaion, { - propsData: { + props: { totalItems: 50, showPageSize: 5, }, diff --git a/src/picker/test/cascade.legacy.js b/src/picker/test/cascade.legacy.js index f7c6b7ea6..cb4d34c9e 100644 --- a/src/picker/test/cascade.legacy.js +++ b/src/picker/test/cascade.legacy.js @@ -32,7 +32,7 @@ const COLUMNS = [ test('cascade columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: COLUMNS, }, @@ -51,7 +51,7 @@ test('cascade columns', () => { test('setColumnValue of cascade columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: COLUMNS, }, @@ -68,7 +68,7 @@ test('setColumnValue of cascade columns', () => { test('setValues of cascade columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: COLUMNS, }, @@ -81,7 +81,7 @@ test('setValues of cascade columns', () => { test('setColumnIndex of cascade columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: COLUMNS, }, @@ -98,7 +98,7 @@ test('setColumnIndex of cascade columns', () => { test('setIndexes of cascade columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: COLUMNS, }, @@ -111,7 +111,7 @@ test('setIndexes of cascade columns', () => { test('disabled in cascade', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: [ COLUMNS[0], @@ -128,7 +128,7 @@ test('disabled in cascade', () => { test('should move to next option when default option is disabled', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns: [ { text: 'A1', @@ -148,7 +148,7 @@ test('should move to next option when default option is disabled', () => { test('should move to first option when all options are disabled', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns: [ { text: 'A1', diff --git a/src/picker/test/index.legacy.js b/src/picker/test/index.legacy.js index f42e899a2..bea5ae3a8 100644 --- a/src/picker/test/index.legacy.js +++ b/src/picker/test/index.legacy.js @@ -16,7 +16,7 @@ const columns = [ test('simple columns confirm & cancel event', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: simpleColumn, }, @@ -31,7 +31,7 @@ test('simple columns confirm & cancel event', () => { test('multiple columns confirm & cancel event', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns, }, @@ -51,7 +51,7 @@ test('multiple columns confirm & cancel event', () => { test('set picker values', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns, }, }); @@ -89,7 +89,7 @@ test('set picker values', () => { test('drag columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns, }, }); @@ -104,7 +104,7 @@ test('drag columns', () => { test('drag simple columns', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns: simpleColumn, }, }); @@ -120,7 +120,7 @@ test('drag simple columns', () => { test('column watch default index', async () => { const disabled = { disabled: true, text: 1 }; const wrapper = mount(PickerColumn, { - propsData: { + props: { initialOptions: [disabled, ...simpleColumn], valueKey: 'text', itemHeight: 50, @@ -206,7 +206,7 @@ test('simulation finger swipe again before transitionend', () => { }; const wrapper = mount(Picker, { - propsData: { + props: { columns: simpleColumn, }, }); @@ -225,7 +225,7 @@ test('click column item', () => { { text: '嘉兴', disabled: true }, ]; const wrapper = mount(Picker, { - propsData: { + props: { columns, }, }); @@ -236,7 +236,7 @@ test('click column item', () => { test('toolbar-position prop', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, toolbarPosition: 'bottom', }, @@ -247,7 +247,7 @@ test('toolbar-position prop', () => { test('not allow html', () => { const wrapper = mount(Picker, { - propsData: { + props: { allowHtml: false, columns: ['
option
'], }, @@ -258,7 +258,7 @@ test('not allow html', () => { test('columns-top、columns-bottom prop', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, }, scopedSlots: { @@ -272,7 +272,7 @@ test('columns-top、columns-bottom prop', () => { test('watch columns change', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: ['1', '2'], defaultIndex: 1, @@ -289,7 +289,7 @@ test('watch columns change', () => { test('should not reset index when columns unchanged', () => { const wrapper = mount(Picker, { - propsData: { + props: { showToolbar: true, columns: ['1', '2'], }, @@ -310,7 +310,7 @@ test('set rem item-height', async () => { window.getComputedStyle = () => ({ fontSize: '16px' }); const wrapper = mount(Picker, { - propsData: { + props: { columns: simpleColumn.slice(0, 2), itemHeight: '10rem', }, @@ -324,7 +324,7 @@ test('set rem item-height', async () => { test('readonly prop', () => { const wrapper = mount(Picker, { - propsData: { + props: { columns, readonly: true, }, diff --git a/src/popup/test/index.legacy.js b/src/popup/test/index.legacy.js index 43fecea8c..6534fa14a 100644 --- a/src/popup/test/index.legacy.js +++ b/src/popup/test/index.legacy.js @@ -15,7 +15,7 @@ test('lazy render', () => { test('reset z-index', () => { wrapper = mount(Popup, { - propsData: { + props: { value: true, zIndex: 10, lockScroll: false, @@ -27,7 +27,7 @@ test('reset z-index', () => { test('popup lock scroll', () => { const wrapper1 = mount(Popup, { - propsData: { + props: { value: true, }, }); @@ -36,7 +36,7 @@ test('popup lock scroll', () => { triggerDrag(document, 0, -150); const wrapper2 = mount(Popup, { - propsData: { + props: { value: true, }, }); @@ -197,7 +197,7 @@ test('open & close event', () => { test('click event', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, }, }); @@ -208,7 +208,7 @@ test('click event', () => { test('duration prop when position is center', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, duration: 0.5, }, @@ -219,7 +219,7 @@ test('duration prop when position is center', () => { test('duration prop when position is top', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, duration: 0.5, position: 'top', @@ -231,7 +231,7 @@ test('duration prop when position is top', () => { test('round prop', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, round: true, }, @@ -242,7 +242,7 @@ test('round prop', () => { test('closeable prop', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, closeable: true, }, @@ -254,7 +254,7 @@ test('closeable prop', () => { test('close-icon prop', () => { const wrapper = mount(Popup, { - propsData: { + props: { value: true, closeable: true, closeIcon: 'success', diff --git a/src/progress/test/index.legacy.js b/src/progress/test/index.legacy.js index 8d74097ab..1e67e4626 100644 --- a/src/progress/test/index.legacy.js +++ b/src/progress/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, later } from '../../../test'; test('calc width', async () => { const wrapper = mount(Progress, { - propsData: { + props: { showPivot: false, percentage: 100, }, @@ -19,7 +19,7 @@ test('calc width', async () => { test('track color prop', async () => { const wrapper = mount(Progress, { - propsData: { + props: { trackColor: 'green', }, }); diff --git a/src/pull-refresh/test/index.legacy.js b/src/pull-refresh/test/index.legacy.js index 664d011a0..e2ba94720 100644 --- a/src/pull-refresh/test/index.legacy.js +++ b/src/pull-refresh/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, later, trigger, triggerDrag } from '../../../test'; test('change head content when pulling down', async () => { const wrapper = mount(PullRefresh, { - propsData: { + props: { value: false, }, listeners: { @@ -77,7 +77,7 @@ test('custom content by slots', async () => { test('pull a short distance', () => { const wrapper = mount(PullRefresh, { - propsData: { + props: { value: false, }, }); @@ -89,7 +89,7 @@ test('pull a short distance', () => { test('not in page top', () => { const wrapper = mount(PullRefresh, { - propsData: { + props: { value: false, }, }); @@ -107,7 +107,7 @@ test('not in page top', () => { test('render success text', async () => { const wrapper = mount(PullRefresh, { - propsData: { + props: { successText: 'success', successDuration: 0, }, @@ -159,7 +159,7 @@ test('render success slot', async () => { test('should set height when using head-height', async () => { const wrapper = mount(PullRefresh, { - propsData: { + props: { headHeight: 100, }, }); diff --git a/src/rate/test/index.legacy.js b/src/rate/test/index.legacy.js index 24bae2509..80c20b58a 100644 --- a/src/rate/test/index.legacy.js +++ b/src/rate/test/index.legacy.js @@ -40,7 +40,7 @@ test('allow half', () => { const onChange = jest.fn(); const wrapper = mount(Rate, { - propsData: { + props: { allowHalf: true, }, listeners: { @@ -60,7 +60,7 @@ test('disabled', () => { const onChange = jest.fn(); const wrapper = mount(Rate, { - propsData: { + props: { disabled: true, }, listeners: { @@ -99,7 +99,7 @@ test('touchmove to select item', () => { test('touchmove to select half item', () => { const onChange = jest.fn(); const wrapper = mount(Rate, { - propsData: { + props: { allowHalf: true, }, listeners: { @@ -120,7 +120,7 @@ test('touchmove to select half item', () => { test('gutter prop', () => { const wrapper = mount(Rate, { - propsData: { + props: { gutter: 10, }, }); @@ -130,7 +130,7 @@ test('gutter prop', () => { test('size prop', () => { const wrapper = mount(Rate, { - propsData: { + props: { size: '2rem', }, }); @@ -141,7 +141,7 @@ test('size prop', () => { test('untouchable', () => { const onChange = jest.fn(); const wrapper = mount(Rate, { - propsData: { + props: { touchable: false, }, listeners: { diff --git a/src/search/test/index.legacy.js b/src/search/test/index.legacy.js index 78b0e7b8d..ef887251f 100644 --- a/src/search/test/index.legacy.js +++ b/src/search/test/index.legacy.js @@ -23,7 +23,7 @@ test('cancel event', () => { const onCancel = jest.fn(); const wrapper = mount(Search, { - propsData: { + props: { value: 'test', showAction: true, }, @@ -85,7 +85,7 @@ test('left slot', () => { test('left-icon prop', () => { const wrapper = mount(Search, { - propsData: { + props: { leftIcon: 'setting-o', }, }); @@ -95,7 +95,7 @@ test('left-icon prop', () => { test('right-icon prop', () => { const wrapper = mount(Search, { - propsData: { + props: { rightIcon: 'setting-o', }, }); @@ -115,7 +115,7 @@ test('right-icon slot', () => { test('action-text prop', () => { const wrapper = mount(Search, { - propsData: { + props: { actionText: 'Custom Text', showAction: true, }, diff --git a/src/share-sheet/test/index.legacy.js b/src/share-sheet/test/index.legacy.js index ef44dabe0..e415a96bf 100644 --- a/src/share-sheet/test/index.legacy.js +++ b/src/share-sheet/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, trigger, later } from '../../../test'; test('cancel-text prop', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, cancelText: 'foo', }, @@ -17,7 +17,7 @@ test('cancel-text prop', () => { test('description prop', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, description: 'foo', }, @@ -31,7 +31,7 @@ test('description prop', () => { test('option className', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, options: [{ name: 'Link', icon: 'link', className: 'foo' }], }, @@ -44,7 +44,7 @@ test('option className', () => { test('select event', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, options: [{ icon: 'wechat', name: 'wechat' }], }, @@ -59,7 +59,7 @@ test('select event', () => { test('cancel event', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, }, }); @@ -72,7 +72,7 @@ test('cancel event', () => { test('title & description slot', () => { const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, }, scopedSlots: { @@ -87,7 +87,7 @@ test('title & description slot', () => { test('click-overlay event', async () => { const root = document.createElement('div'); const wrapper = mount(ShareSheet, { - propsData: { + props: { value: true, teleport: root, }, diff --git a/src/skeleton/test/index.legacy.js b/src/skeleton/test/index.legacy.js index 13fbe6b19..be913c433 100644 --- a/src/skeleton/test/index.legacy.js +++ b/src/skeleton/test/index.legacy.js @@ -3,7 +3,7 @@ import Skeleton from '..'; test('row-width array', () => { const wrapper = mount(Skeleton, { - propsData: { + props: { row: 4, rowWidth: ['100%', 30, '5rem'], }, @@ -25,7 +25,7 @@ test('render chidren', () => { test('avatar shape', () => { const wrapper = mount(Skeleton, { - propsData: { + props: { avatar: true, avatarSize: 20, avatarShape: 'square', @@ -36,7 +36,7 @@ test('avatar shape', () => { test('round prop', () => { const wrapper = mount(Skeleton, { - propsData: { + props: { title: true, round: true, avatar: true, @@ -47,7 +47,7 @@ test('round prop', () => { test('disable animate', () => { const wrapper = mount(Skeleton, { - propsData: { + props: { row: 1, aniamte: false, }, diff --git a/src/slider/test/index.legacy.js b/src/slider/test/index.legacy.js index a0c2b9c71..a0d49d4a0 100644 --- a/src/slider/test/index.legacy.js +++ b/src/slider/test/index.legacy.js @@ -19,7 +19,7 @@ test('drag button', () => { const restoreMock = mockRect(); const wrapper = mount(Slider, { - propsData: { + props: { value: 50, disabled: true, }, @@ -50,7 +50,7 @@ test('click bar', () => { const restoreMock = mockRect(); const wrapper = mount(Slider, { - propsData: { + props: { value: 50, disabled: true, }, @@ -74,7 +74,7 @@ test('drag button vertical', () => { const restoreMock = mockRect(true); const wrapper = mount(Slider, { - propsData: { + props: { value: 50, vertical: true, }, @@ -95,7 +95,7 @@ test('click vertical', () => { const restoreMock = mockRect(true); const wrapper = mount(Slider, { - propsData: { + props: { value: 50, vertical: true, }, @@ -113,7 +113,7 @@ test('click vertical', () => { test('bar-height prop', () => { const wrapper = mount(Slider, { - propsData: { + props: { value: 50, barHeight: 10, }, @@ -124,7 +124,7 @@ test('bar-height prop', () => { test('button-size prop', () => { const wrapper = mount(Slider, { - propsData: { + props: { value: 50, buttonSize: 10, }, @@ -135,7 +135,7 @@ test('button-size prop', () => { test('should not emit change event when value not changed', () => { const wrapper = mount(Slider, { - propsData: { + props: { value: 50, }, listeners: { @@ -153,7 +153,7 @@ test('should not emit change event when value not changed', () => { test('should format initial value', (done) => { mount(Slider, { - propsData: { + props: { value: null, }, listeners: { diff --git a/src/stepper/test/index.legacy.js b/src/stepper/test/index.legacy.js index 50080d23d..df0d8edb5 100644 --- a/src/stepper/test/index.legacy.js +++ b/src/stepper/test/index.legacy.js @@ -3,7 +3,7 @@ import { mount, later } from '../../../test'; test('disabled stepper', () => { const wrapper = mount(Stepper, { - propsData: { + props: { disabled: true, }, }); @@ -12,7 +12,7 @@ test('disabled stepper', () => { test('disable stepper input', () => { const wrapper = mount(Stepper, { - propsData: { + props: { disableInput: true, }, }); @@ -21,7 +21,7 @@ test('disable stepper input', () => { test('disable button', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 5, }, }); @@ -50,7 +50,7 @@ test('disable button', async () => { test('click button', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, max: 2, }, @@ -70,7 +70,7 @@ test('click button', () => { test('long press', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, }, }); @@ -91,7 +91,7 @@ test('long press', async () => { test('disable long press', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, longPress: false, }, @@ -107,7 +107,7 @@ test('disable long press', async () => { test('filter value during user input', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, }, }); @@ -130,7 +130,7 @@ test('filter value during user input', () => { test('shoud watch value and format it', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, max: 5, }, @@ -142,7 +142,7 @@ test('shoud watch value and format it', () => { test('only allow interger', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, integer: true, }, @@ -159,7 +159,7 @@ test('only allow interger', () => { test('input invalid value and blur', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: '', }, }); @@ -174,7 +174,7 @@ test('input invalid value and blur', () => { test('stepper focus', () => { const wrapper = mount(Stepper, { - propsData: { + props: { disableInput: true, }, }); @@ -190,7 +190,7 @@ test('stepper focus', () => { test('stepper blur', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 5, min: 3, }, @@ -212,7 +212,7 @@ test('stepper blur', () => { test('input-width prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { inputWidth: '10rem', }, }); @@ -221,7 +221,7 @@ test('input-width prop', () => { test('button-size prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { buttonSize: '2rem', }, }); @@ -230,7 +230,7 @@ test('button-size prop', () => { test('async-change prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, asyncChange: true, }, @@ -252,7 +252,7 @@ test('async-change prop', () => { test('min value is 0', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, min: 0, }, @@ -268,7 +268,7 @@ test('min value is 0', () => { test('show-plus & show-minus props', () => { const wrapper = mount(Stepper, { - propsData: { + props: { showPlus: false, showMinus: false, }, @@ -279,7 +279,7 @@ test('show-plus & show-minus props', () => { test('decimal-length prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, step: 0.2, decimalLength: 2, @@ -295,7 +295,7 @@ test('decimal-length prop', () => { test('should limit decimal-length when input', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, step: 0.2, decimalLength: 1, @@ -324,7 +324,7 @@ test('name prop', () => { test('change min and max', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1, }, }); @@ -349,7 +349,7 @@ test('change min and max', async () => { test('change decimal-length', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1.33, }, }); @@ -365,7 +365,7 @@ test('change decimal-length', async () => { test('change integer', async () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: 1.33, }, }); @@ -381,7 +381,7 @@ test('change integer', async () => { test('placeholder prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { placeholder: 'foo', }, }); @@ -390,7 +390,7 @@ test('placeholder prop', () => { test('allow-empty prop', () => { const wrapper = mount(Stepper, { - propsData: { + props: { value: '', allowEmpty: true, }, diff --git a/src/swipe-cell/test/index.legacy.js b/src/swipe-cell/test/index.legacy.js index cab18db48..1695d23e8 100644 --- a/src/swipe-cell/test/index.legacy.js +++ b/src/swipe-cell/test/index.legacy.js @@ -8,7 +8,7 @@ import { const THRESHOLD = 0.15; const defaultProps = { - propsData: { + props: { leftWidth: 100, rightWidth: 100, }, @@ -47,8 +47,8 @@ test('before-close prop', () => { const wrapper = mount(SwipeCell, { ...defaultProps, - propsData: { - ...defaultProps.propsData, + props: { + ...defaultProps.props, beforeClose(params) { ({ position } = params); ({ instance } = params); @@ -81,8 +81,8 @@ test('before-close prop', () => { test('name prop', (done) => { const wrapper = mount(SwipeCell, { ...defaultProps, - propsData: { - ...defaultProps.propsData, + props: { + ...defaultProps.props, name: 'test', onClose(position, instance, detail) { expect(detail.name).toEqual('test'); @@ -104,8 +104,8 @@ test('should reset after drag', () => { test('disabled prop', () => { const wrapper = mount(SwipeCell, { - propsData: { - ...defaultProps.propsData, + props: { + ...defaultProps.props, disabled: true, }, }); diff --git a/src/swipe/test/index.legacy.js b/src/swipe/test/index.legacy.js index bf737c9fd..b0bf70edf 100644 --- a/src/swipe/test/index.legacy.js +++ b/src/swipe/test/index.legacy.js @@ -92,7 +92,7 @@ test('initial swipe', () => { test('vertical swipe', () => { const wrapper = mount(Component, { - propsData: { + props: { vertical: true, }, }); @@ -105,7 +105,7 @@ test('vertical swipe', () => { test('untouchable', () => { const wrapper = mount(Component, { - propsData: { + props: { touchable: false, }, }); @@ -140,7 +140,7 @@ test('loop', () => { test('should pause auto play when page hidden', async () => { const change = jest.fn(); mount(Component, { - propsData: { + props: { loop: true, autoplay: 1, }, diff --git a/src/switch/test/index.legacy.js b/src/switch/test/index.legacy.js index 888a30c34..58580657c 100644 --- a/src/switch/test/index.legacy.js +++ b/src/switch/test/index.legacy.js @@ -24,7 +24,7 @@ test('disabled', () => { input, change, }, - propsData: { + props: { disabled: true, }, }); @@ -38,7 +38,7 @@ test('active-value & inactive-value prop', () => { const input = jest.fn(); const change = jest.fn(); const wrapper = mount(Switch, { - propsData: { + props: { value: '1', activeValue: '1', inactiveValue: '2', @@ -57,7 +57,7 @@ test('active-value & inactive-value prop', () => { test('inactive-color prop', () => { const wrapper = mount(Switch, { - propsData: { + props: { value: '2', inactiveValue: '2', inactiveColor: 'black', @@ -69,7 +69,7 @@ test('inactive-color prop', () => { test('size prop', () => { const wrapper = mount(Switch, { - propsData: { + props: { size: 20, }, }); diff --git a/src/tab/test/index.legacy.js b/src/tab/test/index.legacy.js index bc4c0e5a2..166bccee9 100644 --- a/src/tab/test/index.legacy.js +++ b/src/tab/test/index.legacy.js @@ -138,7 +138,7 @@ test('render nav-left & nav-right slot', async () => { test('border props', async () => { const wrapper = mount(Tabs, { - propsData: { + props: { border: false, }, }); diff --git a/src/tabbar/test/index.legacy.js b/src/tabbar/test/index.legacy.js index 6c015745a..8788bc7e2 100644 --- a/src/tabbar/test/index.legacy.js +++ b/src/tabbar/test/index.legacy.js @@ -164,7 +164,7 @@ test('name prop', () => { test('disable border', () => { const wrapper = mount(Tabbar, { - propsData: { + props: { border: false, }, }); @@ -176,7 +176,7 @@ test('placeholder prop', () => { const restore = mockGetBoundingClientRect({ height: 50 }); const wrapper = mount(Tabbar, { - propsData: { + props: { fixed: true, placeholder: true, }, diff --git a/src/tag/test/index.legacy.js b/src/tag/test/index.legacy.js index 33c9448ae..ad860b30b 100644 --- a/src/tag/test/index.legacy.js +++ b/src/tag/test/index.legacy.js @@ -18,7 +18,7 @@ test('click event', () => { test('close event', () => { const close = jest.fn(); const wrapper = mount(Tag, { - propsData: { + props: { closeable: true, }, context: { @@ -37,7 +37,7 @@ test('should not trigger click event when close', () => { const click = jest.fn(); const wrapper = mount(Tag, { - propsData: { + props: { closeable: true, }, context: { diff --git a/src/tree-select/test/index.legacy.js b/src/tree-select/test/index.legacy.js index cc16d2958..567c04955 100644 --- a/src/tree-select/test/index.legacy.js +++ b/src/tree-select/test/index.legacy.js @@ -30,7 +30,7 @@ test('click-nav event', () => { const onClickNav = jest.fn(); const wrapper = mount(TreeSelect, { - propsData: { + props: { items: mockItems, }, context: { @@ -50,7 +50,7 @@ test('click-item event', () => { const onClickItem = jest.fn(); const wrapper = mount(TreeSelect, { - propsData: { + props: { items: mockItems, }, context: { @@ -69,7 +69,7 @@ test('click disabled nav', () => { const onClickNav = jest.fn(); const wrapper = mount(TreeSelect, { - propsData: { + props: { items: [ { text: 'group1', @@ -93,7 +93,7 @@ test('click disabled nav', () => { test('click disabled item', () => { const onClickItem = jest.fn(); const wrapper = mount(TreeSelect, { - propsData: { + props: { items: [ { text: 'group1', @@ -120,7 +120,7 @@ test('click disabled item', () => { test('content slot', () => { const wrapper = mount(TreeSelect, { - propsData: { + props: { items: [ { text: 'group1', @@ -137,7 +137,7 @@ test('content slot', () => { test('height prop', () => { const wrapper = mount(TreeSelect, { - propsData: { + props: { height: '100vh', }, }); @@ -147,7 +147,7 @@ test('height prop', () => { test('nav render badge', () => { const wrapper = mount(TreeSelect, { - propsData: { + props: { items: [ { text: 'group1', @@ -275,7 +275,7 @@ test('max prop', () => { test('className of nav', () => { const wrapper = mount(TreeSelect, { - propsData: { + props: { mainActiveIndex: 0, items: [ { @@ -327,7 +327,7 @@ test('should sync value before trigger click-item event', (done) => { test('selected-icon prop', () => { const wrapper = mount(TreeSelect, { - propsData: { + props: { items: mockItems, activeId: 1, mainActiveIndex: 0, diff --git a/src/uploader/test/index.legacy.js b/src/uploader/test/index.legacy.js index eaafce47e..32ca85109 100644 --- a/src/uploader/test/index.legacy.js +++ b/src/uploader/test/index.legacy.js @@ -27,7 +27,7 @@ window.FileReader = function () { test('disabled', () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { disabled: true, afterRead, }, @@ -39,7 +39,7 @@ test('disabled', () => { test('result-type as text', (done) => { const wrapper = mount(Uploader, { - propsData: { + props: { resultType: 'text', afterRead: (readFile) => { expect(readFile.content).toEqual(mockFileDataUrl); @@ -53,7 +53,7 @@ test('result-type as text', (done) => { test('result-type as file', (done) => { const wrapper = mount(Uploader, { - propsData: { + props: { resultType: 'file', afterRead: (readFile) => { expect(readFile.file).toBeTruthy(); @@ -68,7 +68,7 @@ test('result-type as file', (done) => { test('set input name', (done) => { const wrapper = mount(Uploader, { - propsData: { + props: { name: 'uploader', beforeRead: (readFile, detail) => { expect(detail.name).toEqual('uploader'); @@ -87,7 +87,7 @@ test('set input name', (done) => { test('unknown resultType', () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { resultType: 'xxxx', afterRead, }, @@ -99,7 +99,7 @@ test('unknown resultType', () => { test('before read return false', () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { beforeRead: () => false, afterRead, }, @@ -115,7 +115,7 @@ test('before read return false', () => { test('before read return promise and resolve', async () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { beforeRead: () => new Promise((resolve) => { resolve(file); @@ -133,7 +133,7 @@ test('before read return promise and resolve', async () => { test('before read return promise and resolve no value', async () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { beforeRead: () => new Promise((resolve) => { resolve(); @@ -152,7 +152,7 @@ test('before read return promise and resolve no value', async () => { test('before read return promise and reject', async () => { const afterRead = jest.fn(); const wrapper = mount(Uploader, { - propsData: { + props: { beforeRead: () => new Promise((resolve, reject) => { reject(); @@ -171,7 +171,7 @@ test('before read return promise and reject', async () => { test('file size overlimit', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { maxSize: 1, }, }); @@ -191,7 +191,7 @@ test('file size overlimit', async () => { test('render upload-text', () => { const wrapper = mount(Uploader, { - propsData: { + props: { uploadText: 'Text', }, }); @@ -201,7 +201,7 @@ test('render upload-text', () => { test('render preview image', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [ { url: 'https://img.yzcdn.cn/vant/cat.jpeg' }, { url: 'https://img.yzcdn.cn/vant/test.pdf' }, @@ -223,7 +223,7 @@ test('render preview image', async () => { test('image-fit prop', () => { const wrapper = mount(Uploader, { - propsData: { + props: { imageFit: 'contain', fileList: [{ url: 'https://img.yzcdn.cn/vant/cat.jpeg' }], }, @@ -234,7 +234,7 @@ test('image-fit prop', () => { test('upload-icon prop', () => { const wrapper = mount(Uploader, { - propsData: { + props: { uploadIcon: 'add', }, }); @@ -244,7 +244,7 @@ test('upload-icon prop', () => { test('disable preview image', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [], previewImage: false, }, @@ -263,7 +263,7 @@ test('disable preview image', async () => { test('max-count prop', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [], maxCount: 1, }, @@ -282,7 +282,7 @@ test('max-count prop', async () => { test('preview-size prop', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [], previewSize: 30, }, @@ -301,7 +301,7 @@ test('preview-size prop', async () => { test('deletable prop', () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], }, }); @@ -314,7 +314,7 @@ test('deletable prop', () => { test('delete preview image', () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], previewSize: 30, }, @@ -334,7 +334,7 @@ test('delete preview image', () => { test('before-delete prop return false', () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], beforeDelete: () => false, }, @@ -346,7 +346,7 @@ test('before-delete prop return false', () => { test('before-delete prop return true', () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], beforeDelete: () => true, }, @@ -358,7 +358,7 @@ test('before-delete prop return true', () => { test('before-delete prop resolved', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], beforeDelete: () => new Promise((resolve) => resolve()), }, @@ -371,7 +371,7 @@ test('before-delete prop resolved', async () => { test('before-delete prop rejected', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], beforeDelete: () => new Promise((resolve, reject) => reject()), }, @@ -384,7 +384,7 @@ test('before-delete prop rejected', async () => { test('click to preview image', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { previewFullImage: false, fileList: [{ url: IMAGE }, { url: PDF }], }, @@ -408,7 +408,7 @@ test('click to preview image', async () => { test('preview-options prop', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], previewOptions: { closeable: true, @@ -443,7 +443,7 @@ test('closeImagePreview method', () => { test('click-preview event', () => { const wrapper = mount(Uploader, { - propsData: { + props: { previewFullImage: false, fileList: [{ url: IMAGE }, { url: PDF }], }, @@ -459,7 +459,7 @@ test('click-preview event', () => { test('close-preview event', async () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }], }, }); @@ -483,7 +483,7 @@ test('show-upload prop', () => { test('file message should be reactive', (done) => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [], afterRead(file) { file.status = 'uploading'; @@ -514,7 +514,7 @@ test('multiFile upload filter max-size file', async () => { }; const wrapper = mount(Uploader, { - propsData: { + props: { maxSize: 1000, }, }); @@ -527,7 +527,7 @@ test('multiFile upload filter max-size file', async () => { test('preview-cover slot', () => { const wrapper = mount(Uploader, { - propsData: { + props: { fileList: [{ url: IMAGE }, { url: IMAGE }], }, scopedSlots: {