mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-06-03 12:19:15 +08:00
test: replace propsData with props
This commit is contained in:
parent
c33720a793
commit
e627805746
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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',
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
|
@ -23,7 +23,7 @@ test('click event', () => {
|
||||
test('click-thumb event', () => {
|
||||
const onClickThumb = jest.fn();
|
||||
const wrapper = mount(Card, {
|
||||
propsData: {
|
||||
props: {
|
||||
thumb: 'xx',
|
||||
},
|
||||
context: {
|
||||
|
@ -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',
|
||||
},
|
||||
|
@ -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',
|
||||
},
|
||||
});
|
||||
|
@ -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',
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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),
|
||||
|
@ -21,7 +21,7 @@ test('confirm & cancel event', () => {
|
||||
|
||||
test('time type', () => {
|
||||
const wrapper = mount(DatetimePicker, {
|
||||
propsData: {
|
||||
props: {
|
||||
type: 'time',
|
||||
minHour: 22,
|
||||
minMinute: 58,
|
||||
|
@ -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',
|
||||
},
|
||||
});
|
||||
|
@ -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: '<span>text</span>',
|
||||
allowHtml: false,
|
||||
@ -148,7 +148,7 @@ test('open & close event', () => {
|
||||
|
||||
test('width prop', () => {
|
||||
const wrapper = mount(DialogComponent, {
|
||||
propsData: {
|
||||
props: {
|
||||
value: true,
|
||||
width: 200,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
|
@ -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: {
|
||||
|
@ -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: '<div class="list-item">list item</div>',
|
||||
},
|
||||
propsData: {
|
||||
props: {
|
||||
direction: 'up',
|
||||
},
|
||||
});
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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',
|
||||
|
@ -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: ['<div>option</div>'],
|
||||
},
|
||||
@ -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,
|
||||
},
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
@ -138,7 +138,7 @@ test('render nav-left & nav-right slot', async () => {
|
||||
|
||||
test('border props', async () => {
|
||||
const wrapper = mount(Tabs, {
|
||||
propsData: {
|
||||
props: {
|
||||
border: false,
|
||||
},
|
||||
});
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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: {
|
||||
|
@ -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,
|
||||
|
@ -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: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user