mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [date-picker] sync input value with time-picker (#20713)
* fix(components): [date-picker] sync input value with time-picker * test: set test case
This commit is contained in:
@@ -627,6 +627,27 @@ describe('DatePickerPanel', () => {
|
||||
expect((right.timeInput as HTMLInputElement).value).toBe('AM 01:01:01')
|
||||
})
|
||||
|
||||
it('should get the display date in disabled-hours callback', async () => {
|
||||
const modelValue = ['2025-05-12 00:00:00', '2025-05-24 00:00:00']
|
||||
const disabledHours = (_role: string, date: dayjs.Dayjs) => {
|
||||
expect(dayjs(date).isSame(modelValue[1])).toBe(true)
|
||||
}
|
||||
const wrapper = mount(() => (
|
||||
<DatePickerPanel
|
||||
model-value={modelValue}
|
||||
type="datetimerange"
|
||||
//@ts-expect-error
|
||||
disabledHours={disabledHours}
|
||||
/>
|
||||
))
|
||||
|
||||
const timeInput = wrapper.findAll(
|
||||
'.el-date-range-picker__editors-wrap input'
|
||||
)[3]
|
||||
await timeInput.trigger('blur')
|
||||
await timeInput.trigger('focus')
|
||||
})
|
||||
|
||||
it('input date', async () => {
|
||||
const value = ref<string[]>([])
|
||||
const wrapper = mount(() => (
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
:visible="minTimePickerVisible"
|
||||
:format="timeFormat"
|
||||
datetime-role="start"
|
||||
:parsed-value="leftDate"
|
||||
:parsed-value="minDate || leftDate"
|
||||
@pick="handleMinTimePick"
|
||||
/>
|
||||
</span>
|
||||
@@ -101,7 +101,7 @@
|
||||
datetime-role="end"
|
||||
:visible="maxTimePickerVisible"
|
||||
:format="timeFormat"
|
||||
:parsed-value="rightDate"
|
||||
:parsed-value="maxDate || rightDate"
|
||||
@pick="handleMaxTimePick"
|
||||
/>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user