增加单独禁用stepper input功能 (#146)

* fix: sku message key

* fix: 改用goods_id当key

* fix: 漏改一处

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

* fix: update doc

* fix: rename spec file
This commit is contained in:
wny
2017-09-26 07:11:59 -05:00
committed by Yao
parent 1ef5cfdfb9
commit be6331ad21
7 changed files with 50 additions and 9 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();
});
});
});