feat: 增加单独禁用stepper input功能

This commit is contained in:
niunai
2017-09-26 16:57:53 +08:00
parent b632fa03c4
commit 178656e0fb
5 changed files with 47 additions and 8 deletions

View File

@@ -60,6 +60,17 @@ describe('Stepper', () => {
});
});
it('only disable stepper input', () => {
wrapper = mount(Stepper, {
propsData: {
disableInput: true
}
});
const input = wrapper.find('.van-stepper__input')[0];
expect(input.hasAttribute('disabled', 'disabled')).to.be.true;
});
it('update stepper value use v-model', (done) => {
wrapper = mount(Stepper, {
propsData: {
@@ -96,7 +107,14 @@ describe('Stepper', () => {
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.currentValue).to.equal(30);
expect(eventStub.calledWith('input'));
done();
// value设置非数字时则使用设置的最小值默认1
wrapper.vm.value = 'abc';
wrapper.update();
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.currentValue).to.equal(1);
done();
});
});
});