fix(components): [time-picker] fix clear for range mode (#8961)

* fix(components): [time-picker] fix clear for range mode

* test: [time-picker] fix test error
This commit is contained in:
blackie
2022-07-26 17:42:40 +08:00
committed by GitHub
parent 251199e783
commit b888046ad4
2 changed files with 30 additions and 1 deletions

View File

@@ -566,6 +566,34 @@ describe('TimePicker(range)', () => {
})
})
it('clear button', async () => {
const initDates = [
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: initDates,
})
)
const findInputWrapper = () => wrapper.find('.el-date-editor')
const findClear = () => wrapper.find('.el-range__close-icon')
await nextTick()
const inputWrapper = findInputWrapper()
await inputWrapper.trigger('mouseenter')
await rAF()
const clearIcon = findClear()
await clearIcon.trigger('click')
await nextTick()
const vm = wrapper.vm as any
expect(vm.value).toEqual(null)
})
it('selectableRange ', async () => {
// left ['08:00:00 - 12:59:59'] right ['11:00:00 - 16:59:59']
const wrapper = _mount(

View File

@@ -86,7 +86,6 @@
]"
:style="($attrs.style as any)"
@click="handleFocusInput"
@mousedown="onMouseDownInput"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
@touchstart="onTouchStartInput"
@@ -109,6 +108,7 @@
:disabled="pickerDisabled"
:readonly="!editable || readonly"
:class="nsRange.b('input')"
@mousedown="onMouseDownInput"
@input="handleStartInput"
@change="handleStartChange"
@focus="handleFocusInput"
@@ -126,6 +126,7 @@
:disabled="pickerDisabled"
:readonly="!editable || readonly"
:class="nsRange.b('input')"
@mousedown="onMouseDownInput"
@focus="handleFocusInput"
@blur="handleBlurInput"
@input="handleEndInput"