mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-30 11:16:12 +08:00
test(components): fix time picker default value in cancel test (#4938)
This commit is contained in:
parent
931bc691e0
commit
1682b18684
@ -463,22 +463,29 @@ describe('TimePicker(range)', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('cancel button', async () => {
|
it('cancel button', async () => {
|
||||||
|
const cancelDates = [
|
||||||
|
new Date(2016, 9, 10, 9, 40),
|
||||||
|
new Date(2016, 9, 10, 15, 40),
|
||||||
|
]
|
||||||
const wrapper = _mount(
|
const wrapper = _mount(
|
||||||
`<el-time-picker
|
`<el-time-picker
|
||||||
v-model="value"
|
v-model="value"
|
||||||
is-range
|
is-range
|
||||||
/>`,
|
/>`,
|
||||||
() => ({ value: '' })
|
() => ({
|
||||||
|
value: cancelDates,
|
||||||
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
const input = wrapper.find('input')
|
const input = wrapper.find('input')
|
||||||
input.trigger('blur')
|
input.trigger('blur')
|
||||||
|
await nextTick()
|
||||||
input.trigger('focus')
|
input.trigger('focus')
|
||||||
await nextTick()
|
await nextTick()
|
||||||
;(document.querySelector('.el-time-panel__btn.cancel') as any).click()
|
;(document.querySelector('.el-time-panel__btn.cancel') as any).click()
|
||||||
await nextTick()
|
await nextTick()
|
||||||
const vm = wrapper.vm as any
|
const vm = wrapper.vm as any
|
||||||
expect(vm.value).toBe('')
|
expect(vm.value).toEqual(cancelDates)
|
||||||
input.trigger('blur')
|
input.trigger('blur')
|
||||||
input.trigger('focus')
|
input.trigger('focus')
|
||||||
await nextTick()
|
await nextTick()
|
||||||
|
Loading…
Reference in New Issue
Block a user