mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
chore: format test cases
This commit is contained in:
parent
66c0b3c1b7
commit
c7e51158aa
@ -123,7 +123,7 @@ test('valid name', () => {
|
||||
expect(errorInfo.name).toBeFalsy();
|
||||
});
|
||||
|
||||
it('valid tel', () => {
|
||||
test('valid tel', () => {
|
||||
const { data, field, button, errorInfo } = createComponent();
|
||||
data.tel = '';
|
||||
button.trigger('click');
|
||||
@ -132,7 +132,7 @@ it('valid tel', () => {
|
||||
expect(errorInfo.tel).toBeFalsy();
|
||||
});
|
||||
|
||||
it('valid areaCode', () => {
|
||||
test('valid areaCode', () => {
|
||||
const { data, button, errorInfo } = createComponent();
|
||||
// areaCode empty
|
||||
data.areaCode = '';
|
||||
@ -145,7 +145,7 @@ it('valid areaCode', () => {
|
||||
expect(errorInfo.areaCode).toBeTruthy();
|
||||
});
|
||||
|
||||
it('valid addressDetail', () => {
|
||||
test('valid addressDetail', () => {
|
||||
const { data, field, button, errorInfo } = createComponent();
|
||||
data.addressDetail = '';
|
||||
button.trigger('click');
|
||||
|
@ -101,7 +101,7 @@ describe('ContactEdit', () => {
|
||||
expect(errorInfo.name).toBeFalsy();
|
||||
});
|
||||
|
||||
it('valid tel', () => {
|
||||
test('valid tel', () => {
|
||||
const { data, field, button, errorInfo, wrapper } = createComponent();
|
||||
data.tel = '';
|
||||
button.trigger('click');
|
||||
|
@ -20,14 +20,14 @@ test('click number key', () => {
|
||||
wrapper.destroy();
|
||||
});
|
||||
|
||||
it('click delete key', () => {
|
||||
test('click delete key', () => {
|
||||
const wrapper = mount(NumberKeyboard);
|
||||
|
||||
clickKey(wrapper.findAll('.van-key').at(11));
|
||||
expect(wrapper.emitted('delete')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('click empty key', () => {
|
||||
test('click empty key', () => {
|
||||
const wrapper = mount(NumberKeyboard);
|
||||
clickKey(wrapper.findAll('.van-key').at(9));
|
||||
expect(wrapper.emitted('input')).toBeFalsy();
|
||||
|
@ -46,7 +46,7 @@ test('drag button', () => {
|
||||
restoreMock();
|
||||
});
|
||||
|
||||
it('click bar', () => {
|
||||
test('click bar', () => {
|
||||
const restoreMock = mockRect();
|
||||
|
||||
const wrapper = mount(Slider, {
|
||||
@ -91,7 +91,7 @@ test('drag button vertical', () => {
|
||||
restoreMock();
|
||||
});
|
||||
|
||||
it('click vertical', () => {
|
||||
test('click vertical', () => {
|
||||
const restoreMock = mockRect(true);
|
||||
|
||||
const wrapper = mount(Slider, {
|
||||
@ -111,7 +111,7 @@ it('click vertical', () => {
|
||||
restoreMock();
|
||||
});
|
||||
|
||||
it('bar-height prop', () => {
|
||||
test('bar-height prop', () => {
|
||||
const wrapper = mount(Slider, {
|
||||
propsData: {
|
||||
value: 50,
|
||||
@ -122,7 +122,7 @@ it('bar-height prop', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('button-size prop', () => {
|
||||
test('button-size prop', () => {
|
||||
const wrapper = mount(Slider, {
|
||||
propsData: {
|
||||
value: 50,
|
||||
@ -133,7 +133,7 @@ it('button-size prop', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not emit change event when value not changed', () => {
|
||||
test('should not emit change event when value not changed', () => {
|
||||
const wrapper = mount(Slider, {
|
||||
propsData: {
|
||||
value: 50,
|
||||
@ -151,7 +151,7 @@ it('should not emit change event when value not changed', () => {
|
||||
expect(wrapper.emitted('change').length).toEqual(1);
|
||||
});
|
||||
|
||||
it('should format initial value', done => {
|
||||
test('should format initial value', done => {
|
||||
mount(Slider, {
|
||||
propsData: {
|
||||
value: null,
|
||||
|
@ -25,7 +25,7 @@ test('create a forbidClick toast', async () => {
|
||||
).toBeFalsy();
|
||||
});
|
||||
|
||||
it('toast disappeared after duration', async () => {
|
||||
test('toast disappeared after duration', async () => {
|
||||
const toast = Toast({
|
||||
duration: 10,
|
||||
});
|
||||
|
@ -37,7 +37,7 @@ test('disabled', () => {
|
||||
expect(afterRead).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('result-type as text', done => {
|
||||
test('result-type as text', done => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
resultType: 'text',
|
||||
@ -51,7 +51,7 @@ it('result-type as text', done => {
|
||||
wrapper.vm.onChange(file);
|
||||
});
|
||||
|
||||
it('result-type as file', done => {
|
||||
test('result-type as file', done => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
resultType: 'file',
|
||||
@ -66,7 +66,7 @@ it('result-type as file', done => {
|
||||
wrapper.vm.onChange(file);
|
||||
});
|
||||
|
||||
it('set input name', done => {
|
||||
test('set input name', done => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
name: 'uploader',
|
||||
@ -84,7 +84,7 @@ it('set input name', done => {
|
||||
wrapper.vm.onChange(file);
|
||||
});
|
||||
|
||||
it('unknown resultType', () => {
|
||||
test('unknown resultType', () => {
|
||||
const afterRead = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
@ -96,7 +96,7 @@ it('unknown resultType', () => {
|
||||
expect(afterRead).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('before read return false', () => {
|
||||
test('before read return false', () => {
|
||||
const afterRead = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
@ -112,7 +112,7 @@ it('before read return false', () => {
|
||||
expect(input.element.value).toEqual('');
|
||||
});
|
||||
|
||||
it('before read return promise and resolve', async () => {
|
||||
test('before read return promise and resolve', async () => {
|
||||
const afterRead = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
@ -130,7 +130,7 @@ it('before read return promise and resolve', async () => {
|
||||
expect(afterRead).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('before read return promise and resolve no value', async () => {
|
||||
test('before read return promise and resolve no value', async () => {
|
||||
const afterRead = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
@ -149,7 +149,7 @@ it('before read return promise and resolve no value', async () => {
|
||||
expect(input.element.value).toEqual('');
|
||||
});
|
||||
|
||||
it('before read return promise and reject', async () => {
|
||||
test('before read return promise and reject', async () => {
|
||||
const afterRead = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
@ -189,7 +189,7 @@ test('file size overlimit', async () => {
|
||||
expect(wrapper.emitted('oversize')[2]).toBeFalsy();
|
||||
});
|
||||
|
||||
it('render upload-text', () => {
|
||||
test('render upload-text', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
uploadText: 'Text',
|
||||
@ -199,7 +199,7 @@ it('render upload-text', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('render preview image', async () => {
|
||||
test('render preview image', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [
|
||||
@ -221,7 +221,7 @@ it('render preview image', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('image-fit prop', () => {
|
||||
test('image-fit prop', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
imageFit: 'contain',
|
||||
@ -232,7 +232,7 @@ it('image-fit prop', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('upload-icon prop', () => {
|
||||
test('upload-icon prop', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
uploadIcon: 'add',
|
||||
@ -242,7 +242,7 @@ it('upload-icon prop', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('disable preview image', async () => {
|
||||
test('disable preview image', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [],
|
||||
@ -261,7 +261,7 @@ it('disable preview image', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('max-count prop', async () => {
|
||||
test('max-count prop', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [],
|
||||
@ -280,7 +280,7 @@ it('max-count prop', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('preview-size prop', async () => {
|
||||
test('preview-size prop', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [],
|
||||
@ -299,7 +299,7 @@ it('preview-size prop', async () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('deletable prop', () => {
|
||||
test('deletable prop', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -312,7 +312,7 @@ it('deletable prop', () => {
|
||||
expect(wrapper.find('.van-uploader__preview-delete').element).toBeFalsy();
|
||||
});
|
||||
|
||||
it('delete preview image', () => {
|
||||
test('delete preview image', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -332,7 +332,7 @@ it('delete preview image', () => {
|
||||
expect(wrapper.emitted('delete')[0]).toBeTruthy();
|
||||
});
|
||||
|
||||
it('before-delete prop return false', () => {
|
||||
test('before-delete prop return false', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -344,7 +344,7 @@ it('before-delete prop return false', () => {
|
||||
expect(wrapper.emitted('delete')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('before-delete prop return true', () => {
|
||||
test('before-delete prop return true', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -356,7 +356,7 @@ it('before-delete prop return true', () => {
|
||||
expect(wrapper.emitted('delete')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('before-delete prop resolved', async () => {
|
||||
test('before-delete prop resolved', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -369,7 +369,7 @@ it('before-delete prop resolved', async () => {
|
||||
expect(wrapper.emitted('delete')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('before-delete prop rejected', async () => {
|
||||
test('before-delete prop rejected', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -382,7 +382,7 @@ it('before-delete prop rejected', async () => {
|
||||
expect(wrapper.emitted('delete')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('click to preview image', () => {
|
||||
test('click to preview image', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
previewFullImage: false,
|
||||
@ -404,7 +404,7 @@ it('click to preview image', () => {
|
||||
expect(images.length).toEqual(1);
|
||||
});
|
||||
|
||||
it('closeImagePreview method', () => {
|
||||
test('closeImagePreview method', () => {
|
||||
const close = jest.fn();
|
||||
const wrapper = mount(Uploader, {
|
||||
mocks: {
|
||||
@ -422,7 +422,7 @@ it('closeImagePreview method', () => {
|
||||
wrapper2.vm.closeImagePreview();
|
||||
});
|
||||
|
||||
it('click-preview event', () => {
|
||||
test('click-preview event', () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
previewFullImage: false,
|
||||
@ -438,7 +438,7 @@ it('click-preview event', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('close-preview event', async () => {
|
||||
test('close-preview event', async () => {
|
||||
const wrapper = mount(Uploader, {
|
||||
propsData: {
|
||||
fileList: [{ url: IMAGE }],
|
||||
@ -455,7 +455,7 @@ it('close-preview event', async () => {
|
||||
expect(wrapper.emitted('close-preview')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('show-upload prop', () => {
|
||||
test('show-upload prop', () => {
|
||||
const wrapper = mount(Uploader);
|
||||
expect(wrapper.contains('.van-uploader__upload')).toBeTruthy();
|
||||
wrapper.setProps({ showUpload: false });
|
||||
|
Loading…
x
Reference in New Issue
Block a user