Merge release/test into dev
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import ElementPlus from 'element-plus'
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { getLastMileOrder } from '../api/lastMileOrders'
|
||||
import LastMileOrderDetailView from './LastMileOrderDetailView.vue'
|
||||
|
||||
const push = vi.hoisted(() => vi.fn())
|
||||
vi.mock('vue-router', () => ({ useRoute: () => ({ params: { orderId: 'internal-order-id' } }), useRouter: () => ({ push }) }))
|
||||
vi.mock('@/core/access/accessPreview', () => ({ useAccessPreviewStore: () => ({ can: () => false }) }))
|
||||
vi.mock('../api/lastMileOrders', () => ({ getLastMileOrder: vi.fn(), createLastMileOrderFee: vi.fn() }))
|
||||
enableAutoUnmount(afterEach)
|
||||
|
||||
describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
beforeEach(() => {
|
||||
push.mockReset()
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({
|
||||
order: { id: 'internal-order-id', customerId: 'customer-1', orderNo: 'FL-WH-001', currentStatus: 'PENDING_ASSIGNMENT', customerName: '示例客户', overseasWarehouseName: '洛杉矶仓', packageCount: 0, palletCount: 2, volumeCbm: 6.374, inboundCode: 'IN-001', containerNo: 'CONT-001', customerRemark: '完整保留客户备注', updatedAt: '2026-09-14T10:00:00' },
|
||||
cargo: [{ id: 'cargo-1', skuCode: 'SKU-001', productNameZh: '测试货物' }], fees: [], statusHistory: [], operationHistory: [],
|
||||
})
|
||||
})
|
||||
|
||||
it('shows one business heading, a semantic status and summary without losing basic fields', async () => {
|
||||
const wrapper = mount(LastMileOrderDetailView, { global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
expect(wrapper.findAll('h1')).toHaveLength(1)
|
||||
expect(wrapper.get('h1').text()).toBe('FL-WH-001')
|
||||
const header = wrapper.get('.density-detail-header')
|
||||
expect(header.text()).not.toContain('尾程订单详情')
|
||||
expect(header.text()).not.toContain('尾程单号')
|
||||
expect(header.get('.status-badge').classes()).toContain('is-warning')
|
||||
expect(header.get('.order-reference-text__copy').classes()).toContain('is-text')
|
||||
const summary = wrapper.get('[aria-label="尾程订单概览"]')
|
||||
expect(summary.findAll('dd').map(item => item.text())).toEqual(['示例客户', '洛杉矶仓', '0 箱', '2 托', '6.374 m³', expect.stringContaining('2026-09-14')])
|
||||
const fields = wrapper.get('dl[aria-label="基本信息"]')
|
||||
expect(fields.findAll('dt')).toHaveLength(20)
|
||||
expect(fields.text()).toContain('CONT-001')
|
||||
expect(fields.text()).toContain('完整保留客户备注')
|
||||
expect(fields.findAll('.wide')).toHaveLength(3)
|
||||
expect(wrapper.text()).not.toContain('internal-order-id')
|
||||
await header.get('.density-back').trigger('click')
|
||||
expect(push).toHaveBeenCalledWith({ name: 'overseas-last-mile-orders' })
|
||||
})
|
||||
|
||||
it('keeps all five tab panels reachable after applying the shared tab style', async () => {
|
||||
const wrapper = mount(LastMileOrderDetailView, { global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
const tabs = wrapper.findAll('[role="tab"]')
|
||||
expect(tabs.map(tab => tab.text())).toEqual(['📋基本信息', '📦货物信息', '🗓️计划信息', '💰费用明细', '📝操作记录'])
|
||||
for (const [index, tab] of tabs.entries()) {
|
||||
await tab.trigger('click')
|
||||
await flushPromises()
|
||||
expect(tab.attributes('aria-selected')).toBe('true')
|
||||
const panel = wrapper.findAll('[role="tabpanel"]')[index]!
|
||||
expect(panel.isVisible()).toBe(true)
|
||||
if (index === 1) expect(panel.text()).toContain('SKU-001')
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user