chore: rename all legacy test cases

This commit is contained in:
chenjiahan
2020-10-13 16:56:11 +08:00
parent ec943578b2
commit f2b6f3d4d1
133 changed files with 0 additions and 0 deletions
+121
View File
@@ -0,0 +1,121 @@
import SubmitBar from '..';
import { mount } from '../../../test';
test('submit event', () => {
const submit = jest.fn();
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 1,
},
on: { submit },
},
});
const button = wrapper.find('.van-button');
button.trigger('click');
expect(submit).toHaveBeenCalled();
});
test('disable submit', () => {
const submit = jest.fn();
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 1,
disabled: true,
},
on: { submit },
},
});
expect(wrapper).toMatchSnapshot();
// disabled
const button = wrapper.find('.van-button');
button.trigger('click');
expect(submit).toHaveBeenCalledTimes(0);
});
test('without price', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
label: 'Label',
},
},
});
expect(wrapper).toMatchSnapshot();
});
test('top slot', () => {
const wrapper = mount(SubmitBar, {
scopedSlots: {
top: () => 'top',
},
});
expect(wrapper).toMatchSnapshot();
});
test('decimal-length prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 111,
decimalLength: 1,
},
},
});
expect(wrapper).toMatchSnapshot();
});
test('suffix-label prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 111,
label: 'Label',
suffixLabel: 'Suffix Label',
},
},
});
expect(wrapper).toMatchSnapshot();
});
test('text-align prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
price: 111,
textAlign: 'left',
},
},
});
expect(wrapper).toMatchSnapshot();
});
test('disable safe-area-inset-bottom prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
safeAreaInsetBottom: false,
},
},
});
expect(wrapper).toMatchSnapshot();
});
test('button-color prop', () => {
const wrapper = mount(SubmitBar, {
context: {
props: {
buttonColor: 'red',
},
},
});
expect(wrapper).toMatchSnapshot();
});