修复订单货柜预约与排车维护界面
This commit is contained in:
@@ -1,11 +1,37 @@
|
||||
import { flushPromises, shallowMount } from '@vue/test-utils'
|
||||
import { flushPromises, mount, shallowMount } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import ElementPlus from 'element-plus'
|
||||
import LoadingListDetailDrawer from './LoadingListDetailDrawer.vue'
|
||||
import type { LoadingDetail } from '../api/platformLoadingLists'
|
||||
|
||||
afterEach(() => vi.restoreAllMocks())
|
||||
|
||||
describe('shared manifest presentation', () => {
|
||||
it('names producer events and retains separate adjustments even when their visible facts match', async () => {
|
||||
const actions = ['CREATE_PLAN', 'ADD_INBOUND', 'ADJUST_ITEM', 'ADJUST_ITEM', 'REMARKS', 'UPDATE_PRELOAD_TRANSPORT']
|
||||
const wrapper = mount(LoadingListDetailDrawer, {
|
||||
props: { mode: 'confirmed', canEdit: false, loading: false, error: null,
|
||||
detail: {
|
||||
summary: { planId: '1', warehouseId: '11', loadingListNo: 'LP-TEST', status: 'COMPLETED' }, items: [],
|
||||
histories: actions.map((actionType, index) => ({
|
||||
historyId: String(index + 1), operationId: `operation-${index + 1}`, itemId: null, actionType,
|
||||
fromStatus: 'EDITING', toStatus: 'EDITING', beforeSnapshot: null, afterSnapshot: null,
|
||||
operatorId: '7', operatorName: '操作员', operationReason: null, occurredAt: '2026-10-21T10:00:00',
|
||||
})),
|
||||
} as unknown as LoadingDetail },
|
||||
global: { plugins: [ElementPlus], directives: { loading: {} }, stubs: { DataTable: true } },
|
||||
})
|
||||
await flushPromises()
|
||||
const rows = wrapper.findAll('.history-section .el-table__body tbody tr')
|
||||
expect(rows).toHaveLength(6)
|
||||
expect(rows.map(row => row.findAll('td')[1]!.text())).toEqual([
|
||||
'创建计划', '加入入仓货物', '调整箱数', '调整箱数', '修改备注', '修改预装运输信息',
|
||||
])
|
||||
expect(wrapper.get('.history-section__toggle').text()).toContain('6 条')
|
||||
expect(wrapper.get('.history-section').text()).not.toContain('状态更新')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it.each([undefined, '返回货柜概览'])('keeps print in the common header and emits return for %s', async (backLabel) => {
|
||||
const print = vi.spyOn(window, 'print').mockImplementation(() => {})
|
||||
const wrapper = shallowMount(LoadingListDetailDrawer, {
|
||||
|
||||
Reference in New Issue
Block a user