test(components): fix time picker default value in cancel test (#4938)

This commit is contained in:
Herrington Darkholme 2021-12-23 00:32:30 -05:00 committed by GitHub
parent 931bc691e0
commit 1682b18684
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,22 +463,29 @@ describe('TimePicker(range)', () => {
})
it('cancel button', async () => {
const cancelDates = [
new Date(2016, 9, 10, 9, 40),
new Date(2016, 9, 10, 15, 40),
]
const wrapper = _mount(
`<el-time-picker
v-model="value"
is-range
/>`,
() => ({ value: '' })
() => ({
value: cancelDates,
})
)
const input = wrapper.find('input')
input.trigger('blur')
await nextTick()
input.trigger('focus')
await nextTick()
;(document.querySelector('.el-time-panel__btn.cancel') as any).click()
await nextTick()
const vm = wrapper.vm as any
expect(vm.value).toBe('')
expect(vm.value).toEqual(cancelDates)
input.trigger('blur')
input.trigger('focus')
await nextTick()