fix input change time (#2956)

pull/2963/head
baiyaaaaa 2017-02-22 16:33:30 +08:00 committed by cinwell.li
parent 651fb58988
commit 61672ce0e2
3 changed files with 27 additions and 25 deletions

View File

@ -170,7 +170,10 @@
this.$emit('focus', event);
},
handleInput(event) {
this.setCurrentValue(event.target.value);
const value = event.target.value;
this.$emit('input', value);
this.setCurrentValue(value);
this.$emit('change', value);
},
handleIconClick(event) {
if (this.onIconClick) {
@ -184,8 +187,6 @@
this.resizeTextarea();
});
this.currentValue = value;
this.$emit('input', value);
this.$emit('change', value);
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.change', [value]);
}

View File

@ -498,9 +498,9 @@ describe('Cascader', () => {
}
}, true);
expect(vm.$el).to.be.exist;
vm.$refs.cascader.inputValue = 'z';
vm.$el.click();
vm.$nextTick(_ => {
vm.$refs.cascader.handleInputChange('z');
setTimeout(_ => {
expect(document.body.querySelector('.el-cascader-menus')).to.be.exist;
@ -523,6 +523,7 @@ describe('Cascader', () => {
}, 500);
}, 300);
});
});
it('props', done => {
vm = createVue({
template: `

View File

@ -214,7 +214,7 @@ describe('Input', () => {
vm.input = 'b';
vm.$nextTick(_ => {
expect(spy.withArgs('b').calledOnce).to.be.true;
expect(spy.withArgs('b').calledOnce).to.be.false;
done();
});
});