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