This commit is contained in:
2026-09-09 14:32:04 +08:00
parent f62a3175f7
commit a2515119b7
8 changed files with 166 additions and 33 deletions
@@ -40,6 +40,21 @@ describe('OceanBookingsView', () => {
expect(source).toContain("access.can('platform:firstleg:ocean-booking:list')")
})
it.each(['DRAFT', 'RELEASED'] as const)('opens printing for %s with incomplete booking data', async (status) => {
vi.mocked(listOceanBookings).mockResolvedValueOnce({ records: [{
id: '183', bookingNo: 'OB-183', status, containerCount: 1,
billOfLadingNo: null, shipperName: null, consigneeName: null,
}], page: 1, size: 20, total: 1, pages: 1 } as never)
const wrapper = mount(OceanBookingsView, { global: { plugins: [ElementPlus], stubs: { OceanBookingPrintDialog: true } } })
await (wrapper.vm as unknown as { load: () => Promise<void> }).load()
await flushPromises()
const button = wrapper.findAll('button').find((item) => item.text().includes('打印单据'))!
expect(button.attributes('disabled')).toBeUndefined()
await button.trigger('click')
expect(wrapper.findComponent({ name: 'OceanBookingPrintDialog' }).attributes('modelvalue')).toBe('true')
wrapper.unmount()
})
it('uses only the frozen DRAFT and RELEASED status options', () => {
expect(source).toContain('options: oceanBookingStatusOptions')
expect(source).toContain(':status="oceanBookingStatusLabel(row.status)"')