优化
This commit is contained in:
@@ -63,6 +63,20 @@ describe('OrderDeclarationEditorDialog', () => {
|
||||
expect([...parent.querySelectorAll('.density-dialog-section__title')].map(title => title.textContent)).toEqual(['原订单资料', '订单申报资料', '货品申报明细 不允许新增、删除或调整明细序号'])
|
||||
expect(parent.style.getPropertyValue('--el-dialog-width')).toBe('min(1180px, calc(100vw - 36px))')
|
||||
expect(parent.querySelector('.density-descriptions')).not.toBeNull()
|
||||
const fields = parent.querySelector<HTMLTableElement>('table[aria-label="订单申报资料"]')!
|
||||
expect(fields.rows).toHaveLength(2)
|
||||
expect([...fields.querySelectorAll('.el-form-item__label')].map(label => label.textContent?.trim())).toEqual(['渠道名称', '渠道编码', '预估体积(m³)', '预计到货时间', '客户备注'])
|
||||
expect(fields.rows[1]!.cells[1]!.colSpan).toBe(2)
|
||||
const remark = fields.querySelector<HTMLInputElement>('input[aria-label="客户备注"]')!
|
||||
remark.value = '待保存的客户备注'
|
||||
remark.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
await flushPromises()
|
||||
for (const label of ['展开全屏', '退出全屏']) {
|
||||
parent.querySelector<HTMLButtonElement>(`button[aria-label="${label}"]`)!.click()
|
||||
await flushPromises()
|
||||
expect(parent.querySelector<HTMLInputElement>('input[aria-label="客户备注"]')!.value).toBe('待保存的客户备注')
|
||||
expect(fields.querySelector('[aria-label="渠道编码"]')!.textContent).toBe('OLD')
|
||||
}
|
||||
parent.querySelector<HTMLButtonElement>('.cargo-table .density-action')!.click()
|
||||
await flushPromises()
|
||||
const dialogs = document.querySelectorAll<HTMLElement>('.el-dialog.admin-density-dialog')
|
||||
@@ -97,10 +111,20 @@ describe('OrderDeclarationEditorDialog', () => {
|
||||
expect(listWarehouseLogisticsChannels).toHaveBeenCalledWith('700000000000000001')
|
||||
expect(wrapper.text()).toContain('国内收货仓和中转仓不可修改,如需变更请重新下单')
|
||||
expect(wrapper.text()).toContain('RK-001')
|
||||
const volume = wrapper.findComponent({ name: 'ElInputNumber' })
|
||||
expect(volume.props()).toMatchObject({ min: 0.0001, precision: 4, controls: false, modelValue: 0.625 })
|
||||
volume.vm.$emit('update:modelValue', 0.875)
|
||||
const arrival = wrapper.findComponent({ name: 'ElDatePicker' })
|
||||
expect(arrival.props()).toMatchObject({ type: 'datetime', valueFormat: 'YYYY-MM-DDTHH:mm:ss', format: 'YYYY-MM-DD HH:mm', clearable: true, modelValue: '2026-09-06T10:00:00' })
|
||||
arrival.vm.$emit('update:modelValue', '2026-09-07T11:30:00')
|
||||
const remark = wrapper.get('input[aria-label="客户备注"]')
|
||||
expect(remark.attributes('maxlength')).toBe('1000')
|
||||
await remark.setValue('调整后的客户备注')
|
||||
const channelSelect = wrapper.findAllComponents({ name: 'ElSelect' })[0]!
|
||||
channelSelect.vm.$emit('update:modelValue', 'NEW')
|
||||
channelSelect.vm.$emit('change', 'NEW')
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.get('span[aria-label="渠道编码"]').text()).toBe('NEW')
|
||||
await wrapper.get('[data-testid="save"]').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
@@ -108,7 +132,9 @@ describe('OrderDeclarationEditorDialog', () => {
|
||||
expect(ElMessageBox.confirm).toHaveBeenCalledWith(expect.stringContaining('纸面上的旧渠道文字不会自动变化'), '确认变更渠道', expect.any(Object))
|
||||
expect(updatePlatformUnifiedOrderDeclaration).toHaveBeenCalledWith('208', '90001', expect.objectContaining({
|
||||
expectedVersion: 7,
|
||||
estimatedVolumeCbm: 0.625,
|
||||
estimatedVolumeCbm: 0.875,
|
||||
expectedArrivalAt: '2026-09-07T11:30:00',
|
||||
customerRemark: '调整后的客户备注',
|
||||
channelCode: 'NEW',
|
||||
channelName: '新渠道',
|
||||
cargoes: [expect.objectContaining({ itemNo: 1, usage: '照明' })],
|
||||
@@ -122,7 +148,8 @@ describe('OrderDeclarationEditorDialog', () => {
|
||||
const wrapper = createWrapper()
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.find('input[aria-label="渠道编码"]').attributes('readonly')).toBeDefined()
|
||||
expect(wrapper.find('input[aria-label="渠道编码"]').exists()).toBe(false)
|
||||
expect(wrapper.get('span[aria-label="渠道编码"]').text()).toBe('OLD')
|
||||
expect(wrapper.findAllComponents({ name: 'ElSelect' })).toHaveLength(1)
|
||||
expect(wrapper.find('.cargo-table').exists()).toBe(true)
|
||||
expect(wrapper.text()).toContain('箱数 / 数量')
|
||||
|
||||
Reference in New Issue
Block a user