fix(input): no trigger input event when clear value (#2723)

fix #2688
This commit is contained in:
msidolphin
2021-07-28 09:24:50 +08:00
committed by GitHub
parent 1b8d27513d
commit ecd6e19c26
2 changed files with 5 additions and 0 deletions

View File

@@ -422,6 +422,7 @@ describe('Input.vue', () => {
test('event:clear', async() => {
const handleClear = jest.fn()
const handleInput = jest.fn()
const wrapper = _mount({
template: `
<el-input
@@ -429,6 +430,7 @@ describe('Input.vue', () => {
clearable
v-model="input"
@clear="handleClear"
@input="handleInput"
/>
`,
setup() {
@@ -437,6 +439,7 @@ describe('Input.vue', () => {
return {
input,
handleClear,
handleInput,
}
},
})
@@ -450,6 +453,7 @@ describe('Input.vue', () => {
await sleep()
expect(vm.input).toEqual('')
expect(handleClear).toBeCalled()
expect(handleInput).toBeCalled()
})
test('event:input', async() => {

View File

@@ -412,6 +412,7 @@ export default defineComponent({
ctx.emit(UPDATE_MODEL_EVENT, '')
ctx.emit('change', '')
ctx.emit('clear')
ctx.emit('input', '')
}
const handlePasswordVisible = () => {