fix(components): [time-picker] cancel button not work correctly (#6735)

This commit is contained in:
Hefty 2022-03-22 17:03:39 +08:00 committed by GitHub
parent ae33485f5a
commit 0d11c121b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -491,9 +491,13 @@ describe('TimePicker(range)', () => {
// For skipping Transition animation
await rAF()
;(document.querySelector('.el-time-panel__btn.cancel') as any).click()
await nextTick()
await rAF()
const vm = wrapper.vm as any
expect(vm.value).toEqual(cancelDates)
expect((wrapper.findComponent(Picker).vm as any).pickerVisible).toEqual(
false
)
expect(document.querySelector('.el-picker-panel')).toBeNull()
input.trigger('blur')
input.trigger('focus')
await nextTick()

View File

@ -112,7 +112,7 @@ export default defineComponent({
const maxDate = computed(() => props.parsedValue[1])
const oldValue = useOldValue(props)
const handleCancel = () => {
ctx.emit('pick', oldValue.value, null)
ctx.emit('pick', oldValue.value, false)
}
const showSeconds = computed(() => {
return props.format.includes('ss')