优化
This commit is contained in:
@@ -124,6 +124,47 @@ async function editWeeklyTemplate() {
|
||||
}
|
||||
|
||||
describe('SailingCalendarView dialog workflows', () => {
|
||||
it('updates the cutoff result for presets and custom days while preserving a manually chosen time', async () => {
|
||||
const view = await mountView()
|
||||
await clickAction(view, '新增单个船次')
|
||||
const dialog = view.findAllComponents(AppDialog).find(item => item.props('title') === '新增船期')!
|
||||
const result = () => document.querySelector('.cutoff-calculated')!.textContent
|
||||
expect(result()).toContain('2026-09-27 18:00')
|
||||
const presets = dialog.findAllComponents({ name: 'ElRadioGroup' }).find(item => item.classes().includes('cutoff-presets'))!
|
||||
presets.vm.$emit('update:modelValue', 2)
|
||||
presets.vm.$emit('change', 2)
|
||||
await flushPromises()
|
||||
expect(result()).toContain('2026-09-28 18:00')
|
||||
const days = dialog.findComponent({ name: 'ElInputNumber' })
|
||||
days.vm.$emit('update:modelValue', 5)
|
||||
days.vm.$emit('change', 5)
|
||||
await flushPromises()
|
||||
expect(result()).toContain('2026-09-25 18:00')
|
||||
expect(presets.props('modelValue')).toBe(5)
|
||||
const time = dialog.findComponent({ name: 'ElTimePicker' })
|
||||
time.vm.$emit('update:modelValue', '16:30:00')
|
||||
time.vm.$emit('change', '16:30:00')
|
||||
await flushPromises()
|
||||
expect(result()).toContain('2026-09-25 16:30')
|
||||
const mode = dialog.findAllComponents({ name: 'ElRadioGroup' }).find(item => item.classes().includes('cutoff-mode-group'))!
|
||||
mode.vm.$emit('update:modelValue', 'custom')
|
||||
mode.vm.$emit('change', 'custom')
|
||||
await flushPromises()
|
||||
expect(document.querySelector('.cutoff-rule-row')).toBeNull()
|
||||
const pickers = dialog.findAllComponents({ name: 'ElDatePicker' })
|
||||
pickers[1].vm.$emit('update:modelValue', '2026-09-29T15:00:00')
|
||||
pickers[1].vm.$emit('change', '2026-09-29T15:00:00')
|
||||
pickers[0].vm.$emit('update:modelValue', '2026-10-02T10:00:00')
|
||||
pickers[0].vm.$emit('change', '2026-10-02T10:00:00')
|
||||
await flushPromises()
|
||||
expect(result()).toContain('2026-09-29 15:00')
|
||||
expect(result()).toContain('自定义时间')
|
||||
mode.vm.$emit('update:modelValue', 'rule')
|
||||
mode.vm.$emit('change', 'rule')
|
||||
await flushPromises()
|
||||
expect(result()).toContain('2026-09-27 16:30')
|
||||
})
|
||||
|
||||
it('retains edited cutoff time and optimistic version through fullscreen and save', async () => {
|
||||
const view = await mountView()
|
||||
await view.get('.sailing-card').trigger('click')
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user