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
@@ -18,7 +18,7 @@ function render(candidates: Candidate[] = [candidate()], extra: Record<string, u
return mount(SmartDispatchCargoBoard, { props: { candidates, draft: draft(), activeContainerId: 'car-1', capacity: 30, disabled: false, warehouseSelected: true, page: 1, size: 20, total: candidates.length, ...extra }, global: { plugins: [ElementPlus] } })
}
async function select(wrapper: VueWrapper, index = 0) { await wrapper.get('[aria-label="待排订单"]').findAll('tbody tr')[index]!.get('button').trigger('click') }
function pallet(wrapper: VueWrapper) { return wrapper.get('[aria-label="托盘明细"] article') }
function pallet(wrapper: VueWrapper) { return wrapper.get('[aria-label="托盘明细"] tr[draggable]') }
function transfer() { return { setData: vi.fn(), getData: vi.fn(() => '{"sourceKey":"forged","containerId":"car-2"}'), effectAllowed: '', dropEffect: '' } }
describe('smart dispatch three-column cargo board', () => {
@@ -26,6 +26,7 @@ describe('smart dispatch three-column cargo board', () => {
const first = candidate(), second = candidate({ sourceKey: 'source-2', orderNo: 'ORDER-2', palletNo: 'PALLET-2' })
const wrapper = render([first, second], { draft: null, activeContainerId: '' })
expect(wrapper.get('[aria-label="托盘明细"]').text()).toContain('请选择左侧订单')
expect(wrapper.get('[aria-label="托盘明细"]').findAll('thead th').map(cell => cell.text())).toEqual(['托盘号', '箱数'])
expect(wrapper.findAll('[aria-label="车辆装载"] article')).toHaveLength(1)
expect(wrapper.get('[aria-label="第 1 辆车"]').text()).toContain('30 托位')
await select(wrapper, 1)
@@ -86,7 +87,7 @@ describe('smart dispatch three-column cargo board', () => {
it('keeps a shared pallet as one full source group even when only one member is on the current page', async () => {
const sources = sharedPalletCandidates(), wrapper = render([sources[0]!])
await select(wrapper)
expect(wrapper.findAll('[aria-label="托盘明细"] article')).toHaveLength(1)
expect(wrapper.findAll('[aria-label="托盘明细"] tr[draggable]')).toHaveLength(1)
const group = pallet(wrapper)
expect(group.text()).toContain('整托关联货物一起加入')
expect(group.findAll('details li')).toHaveLength(2)
@@ -156,7 +157,7 @@ describe('smart dispatch three-column cargo board', () => {
const order = wrapper.get('[aria-label="待排订单"] tbody tr')
expect(order.findAll('td')[3]!.text()).toBe('2')
await select(wrapper)
expect(wrapper.findAll('[aria-label="托盘明细"] article')).toHaveLength(2)
expect(wrapper.findAll('[aria-label="托盘明细"] tr[draggable]')).toHaveLength(2)
})
it('uses independent vehicle radio groups when two entrypoint dialogs are mounted', () => {