2026-10-28 12:01:43 +08:00
|
|
|
import { mount } from '@vue/test-utils'
|
|
|
|
|
import { expect, it } from 'vitest'
|
|
|
|
|
import { createAppointmentForm } from '../appointmentForm'
|
|
|
|
|
import FbaAppointmentFields from './FbaAppointmentFields.vue'
|
|
|
|
|
|
2026-11-05 16:30:28 +08:00
|
|
|
it('keeps only the planned date for new appointments and allows time fields in other flows', async () => {
|
2026-10-28 12:01:43 +08:00
|
|
|
const wrapper = mount(FbaAppointmentFields, {
|
2026-11-05 16:30:28 +08:00
|
|
|
props: { model: createAppointmentForm(), continuous: true, dateOnly: true, timezone: 'America/New_York' },
|
2026-10-28 12:01:43 +08:00
|
|
|
global: { stubs: {
|
|
|
|
|
ElForm: { template: '<form><slot /></form>' },
|
|
|
|
|
ElFormItem: { props: ['label'], template: '<label>{{ label }}<slot /></label>' },
|
|
|
|
|
ElInput: { template: '<input />' },
|
|
|
|
|
ElDatePicker: { template: '<input data-picker />' },
|
|
|
|
|
InlineHelp: true,
|
|
|
|
|
} },
|
|
|
|
|
})
|
|
|
|
|
expect(wrapper.text()).toContain('外部约号')
|
|
|
|
|
expect(wrapper.text()).toContain('计划送仓日期')
|
2026-11-05 16:30:28 +08:00
|
|
|
expect(wrapper.findAll('[data-picker]')).toHaveLength(1)
|
|
|
|
|
expect(wrapper.text()).not.toMatch(/补充计划时段|计划开始时段|计划结束时段|对方确认开始时间|对方确认结束时间|确认开始时差|确认结束时差|夏令时/)
|
|
|
|
|
await wrapper.setProps({ dateOnly: false })
|
|
|
|
|
expect(wrapper.text()).toContain('计划开始时段')
|
|
|
|
|
expect(wrapper.text()).toContain('计划结束时段')
|
2026-10-28 12:01:43 +08:00
|
|
|
expect(wrapper.text()).toContain('对方确认开始时间')
|
|
|
|
|
expect(wrapper.findAll('[data-picker]')).toHaveLength(5)
|
|
|
|
|
wrapper.unmount()
|
|
|
|
|
})
|