update order items
This commit is contained in:
@@ -305,6 +305,7 @@ describe('OrderItemsPage', () => {
|
||||
SearchOutlined: { template: '<span />' },
|
||||
ReloadOutlined: { template: '<span />' },
|
||||
EyeOutlined: { template: '<span />' },
|
||||
CopyOutlined: { template: '<span class="copy-icon-stub" />' },
|
||||
CascadeFilter: { template: '<div class="cascade-filter-stub" />' },
|
||||
},
|
||||
},
|
||||
@@ -317,7 +318,7 @@ describe('OrderItemsPage', () => {
|
||||
it('renders page title and action buttons', async () => {
|
||||
await mountPage()
|
||||
|
||||
expect(wrapper.text()).toContain('订单子项')
|
||||
expect(wrapper.text()).toContain('订单项管理')
|
||||
const buttons = wrapper.findAll('.ant-btn')
|
||||
const buttonTexts = buttons.map((b) => b.text())
|
||||
expect(buttonTexts.some((t) => t.includes('搜索'))).toBe(true)
|
||||
@@ -446,7 +447,7 @@ describe('OrderItemsPage', () => {
|
||||
await nextTick()
|
||||
|
||||
const drawerHtml = document.body.querySelector('.ant-drawer')?.innerHTML || ''
|
||||
expect(drawerHtml).toContain('父订单摘要')
|
||||
expect(drawerHtml).toContain('所属订单')
|
||||
expect(drawerHtml).toContain('ORD-20260101-001')
|
||||
expect(drawerHtml).toContain('199.99')
|
||||
expect(drawerHtml).toContain('189.99')
|
||||
@@ -486,6 +487,20 @@ describe('OrderItemsPage', () => {
|
||||
expect(drawerHtml).toContain('暂无数据')
|
||||
})
|
||||
|
||||
it('shows placeholder when parent_order is null', async () => {
|
||||
const { api } = await mountPage()
|
||||
vi.mocked(api.get).mockResolvedValueOnce({ ...mockItemDetail, parent_order: null })
|
||||
|
||||
const buttons = Array.from(document.body.querySelectorAll('.ant-btn'))
|
||||
const viewBtn = buttons.find((b) => b.textContent?.trim() === '查看')
|
||||
viewBtn?.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
||||
await flushPromises()
|
||||
await nextTick()
|
||||
|
||||
const drawerHtml = document.body.querySelector('.ant-drawer')?.innerHTML || ''
|
||||
expect(drawerHtml).toContain('无关联订单')
|
||||
})
|
||||
|
||||
it('shows error message when detail request fails', async () => {
|
||||
const { api } = await mountPage()
|
||||
const { message } = await import('ant-design-vue')
|
||||
|
||||
Reference in New Issue
Block a user