feat(Stepper): add allow-empty prop (#6759)

* feat(Stepper): add allow-empty prop

* fix: remove test only
This commit is contained in:
neverland
2020-07-11 10:52:28 +08:00
committed by GitHub
parent 709b822c06
commit 060b1fb717
4 changed files with 24 additions and 0 deletions
+17
View File
@@ -387,3 +387,20 @@ test('placeholder prop', () => {
});
expect(wrapper.find('.van-stepper__input')).toMatchSnapshot();
});
test('allow-empty prop', () => {
const wrapper = mount(Stepper, {
propsData: {
value: '',
allowEmpty: true,
},
});
const input = wrapper.find('input');
input.trigger('blur');
expect(wrapper.emitted('input')).toBeFalsy();
wrapper.setProps({ allowEmpty: false });
input.trigger('blur');
expect(wrapper.emitted('input')[0][0]).toEqual(1);
});