优化
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user