Merge branch '2.x' into dev

This commit is contained in:
chenjiahan
2020-12-26 15:52:18 +08:00
10 changed files with 96 additions and 31 deletions
+15 -6
View File
@@ -125,7 +125,7 @@ test('filter value during user input', () => {
input.element.value = '2';
input.trigger('input');
expect(input.element.value).toEqual('2');
expect(wrapper.emitted('input')[1][0]).toEqual('2');
expect(wrapper.emitted('input')[1][0]).toEqual(2);
});
test('shoud watch value and format it', () => {
@@ -149,12 +149,11 @@ test('only allow interger', () => {
});
const input = wrapper.find('input');
input.element.value = '1.2';
input.element.value = '2.2';
input.trigger('input');
input.trigger('blur');
expect(wrapper.emitted('input')[0][0]).toEqual('1');
expect(wrapper.emitted('input')[1][0]).toEqual(1);
expect(wrapper.emitted('input')[0][0]).toEqual(2);
});
test('input invalid value and blur', () => {
@@ -246,8 +245,8 @@ test('async-change prop', () => {
input.element.value = '3';
input.trigger('input');
expect(wrapper.emitted('input')[1][0]).toEqual('3');
expect(wrapper.emitted('change')[1][0]).toEqual('3');
expect(wrapper.emitted('input')[1][0]).toEqual(3);
expect(wrapper.emitted('change')[1][0]).toEqual(3);
});
test('min value is 0', () => {
@@ -277,6 +276,16 @@ test('show-plus & show-minus props', () => {
expect(wrapper.html()).toMatchSnapshot();
});
test('should hide input when show-input prop is false', () => {
const wrapper = mount(Stepper, {
propsData: {
showInput: false,
},
});
expect(wrapper.find('input').element.style.display).toEqual('none');
});
test('decimal-length prop', () => {
const wrapper = mount(Stepper, {
props: {