This commit is contained in:
2026-10-21 14:30:33 +08:00
parent 3953453090
commit 8498798a9c
47 changed files with 791 additions and 409 deletions
@@ -51,6 +51,29 @@ async function emptyMode(dialog: VueWrapper) { field(dialog, '建单方式').get
async function restore(dialog: VueWrapper) { dialog.findAllComponents({ name: 'ElSelect' }).find(select => select.props('placeholder') === '继续待完成排车')!.vm.$emit('change', 'server-token'); await flushPromises() }
async function selectFirstOrder(dialog: VueWrapper) { await view(dialog).get('[aria-label="待排订单"] tbody tr button').trigger('click'); await flushPromises() }
describe('new dispatch native layout', () => {
it('keeps the restored workbench controls together and shows the selected warehouse tab', async () => {
const { dialog } = await render()
const content = view(dialog)
expect(content.get('[aria-label="排车设置"]').text()).toContain('建单方式')
expect(content.get('[aria-label="排车设置"]').find('[aria-label="车辆选货安排"]').exists()).toBe(true)
expect(content.text()).not.toContain('1. 排车设置')
expect(content.text()).not.toContain('2. 为车辆选货')
const vehicles = content.get('[aria-label="车辆装载"]')
expect(vehicles.text()).toContain('托位')
expect(vehicles.get('.cargo-board-vehicle-tools').text()).toContain('添加车辆')
expect(vehicles.text()).toContain('添加车辆')
const tabs = content.get('[aria-label="候选仓库展示"]').findAll('button')
expect(tabs[0]!.classes()).toContain('active')
await selectWarehouse(dialog)
await tabs[1]!.trigger('click'); await flushPromises()
expect(tabs[1]!.attributes('aria-selected')).toBe('true')
expect(tabs[1]!.classes()).toContain('active')
expect(tabs[0]!.classes()).not.toContain('active')
const capacity = dialog.findAllComponents({ name: 'ElSelect' }).find(select => select.props('placeholder') === '计划托位')!
capacity.vm.$emit('update:modelValue', 15); await flushPromises()
expect(content.get('[aria-label="第 1 辆车"]').text()).toContain('15 托位')
})
it('adds cargo directly, preparing the first vehicle internally and enabling submission after assignment', async () => {
const empty: DispatchDraft = { ...draft(), containers: [], sources: [] }
const grouped: DispatchDraft = { ...empty, recordVersion: 1, containers: [{ draftContainerId: 'first-group', sequenceNo: 1, capacity: 30, sourceKeys: [] }] }
@@ -98,7 +121,7 @@ describe('new dispatch native layout', () => {
const { dialog } = await render()
expect(view(dialog).find('[aria-label="排车设置"] table').exists()).toBe(false)
expect(view(dialog).find('[aria-label="排车设置"] .density-dialog-note').exists()).toBe(false)
expect(view(dialog).classes()).toContain('admin-density-workspace')
expect(view(dialog).classes()).not.toContain('admin-density-workspace')
expect(dialog.getComponent({ name: 'ElDialog' }).props()).toMatchObject({ appendToBody: true, lockScroll: true })
expect(view(dialog).text()).not.toContain('点击“开始选货”建立第一组')
expect(view(dialog).text()).not.toContain('选择起运仓后点击')