mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* fix(components): [input-number] fix default value reset error * test(components): [input-number] fix value default value reset error
This commit is contained in:
@@ -429,6 +429,8 @@ describe('InputNumber.vue', () => {
|
||||
elInput.handleInputChange('')
|
||||
await nextTick()
|
||||
expect(num.value).toBe(5)
|
||||
await wrapper.find('input').setValue('')
|
||||
expect(num.value).toBe(5)
|
||||
elInput.decrease()
|
||||
await nextTick()
|
||||
expect(num.value).toBe(4)
|
||||
|
||||
@@ -239,10 +239,12 @@ const setCurrentValue = (
|
||||
emit(UPDATE_MODEL_EVENT, newVal!)
|
||||
return
|
||||
}
|
||||
if (oldVal === newVal) return
|
||||
if (oldVal === newVal && value) return
|
||||
data.userInput = null
|
||||
emit(UPDATE_MODEL_EVENT, newVal!)
|
||||
emit(CHANGE_EVENT, newVal!, oldVal!)
|
||||
if (oldVal !== newVal) {
|
||||
emit(CHANGE_EVENT, newVal!, oldVal!)
|
||||
}
|
||||
if (props.validateEvent) {
|
||||
formItem?.validate?.('change').catch((err) => debugWarn(err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user