feat(Stepper): add disable-plus & disable-minus props (#5180)

This commit is contained in:
Jake
2019-12-03 18:53:47 +08:00
committed by neverland
parent 34a817612d
commit c691accb33
4 changed files with 41 additions and 2 deletions
+29
View File
@@ -19,6 +19,35 @@ test('disable stepper input', () => {
expect(wrapper).toMatchSnapshot();
});
test('disable button', async () => {
const wrapper = mount(Stepper, {
propsData: {
value: 5
}
});
const plus = wrapper.find('.van-stepper__plus');
const minus = wrapper.find('.van-stepper__minus');
minus.trigger('click');
expect(wrapper.emitted('overlimit')).toBeFalsy();
expect(wrapper.emitted('minus')).toBeTruthy();
expect(wrapper.emitted('change')[0]).toEqual([4, { name: '' }]);
wrapper.setProps({
disablePlus: true,
disableMinus: true
});
await later();
minus.trigger('click');
expect(wrapper.emitted('overlimit')[0][0]).toBe('minus');
plus.trigger('click');
expect(wrapper.emitted('overlimit')[1][0]).toBe('plus');
});
test('click button', () => {
const wrapper = mount(Stepper, {
propsData: {