This commit is contained in:
2026-09-15 09:58:15 +08:00
parent 3f998bdb88
commit 4bf66d9571
90 changed files with 1599 additions and 1388 deletions
@@ -64,6 +64,20 @@ describe('supplier route reuse', () => {
mocks.can.mockClear()
})
it('retains all supplier facts with long values and the original back target', async () => {
const name = '供应商完整长名称'.repeat(6)
const address = '浙江省宁波市完整详细地址'.repeat(8)
mocks.getSupplier.mockResolvedValue({ ...supplier('A', name), address, remark: '备注'.repeat(50) })
const wrapper = mount(SupplierDetailView, { global: { plugins: [ElementPlus], stubs } })
await flushPromises()
expect(wrapper.get('.density-detail-title').text()).toBe(name)
expect(wrapper.get('.density-fields').findAll('dt')).toHaveLength(12)
expect(wrapper.get('.density-fields').text()).toContain(address)
expect(wrapper.findAll('.wide-field')).toHaveLength(3)
await wrapper.get('.density-back').trigger('click')
expect(mocks.push).toHaveBeenCalledWith({ name: 'supplier-list' })
})
it('reloads form A to B, ignores late A, and submits B', async () => {
const requestA = deferred<Supplier>(); const requestB = deferred<Supplier>()
mocks.getSupplier.mockImplementation((id: string) => id === 'A' ? requestA.promise : requestB.promise)