This commit is contained in:
2026-10-20 14:52:06 +08:00
parent 5679b156ca
commit 6f7f8e7632
61 changed files with 191 additions and 193 deletions
@@ -111,7 +111,7 @@ describe('inbound appointment native dialogs', () => {
await wrapper.findAll('.el-table__body-wrapper button').find(button => button.text() === (mode === 'permission' ? '查看预约' : '预约'))!.trigger('click'); await flushPromises()
const dialog = popup(wrapper, '查看预约')
expect(dialog.getComponent(FbaAppointmentFields).props('disabled')).toBe(true)
expect(dialog.get('input[placeholder="有需交接的事项时填写"]').attributes('disabled')).toBeDefined()
expect(dialog.get('input[aria-label="预约备注"]').attributes('disabled')).toBeDefined()
expect(dialog.props('showConfirm')).toBe(false)
if (mode === 'replacement') expect(dialog.text()).toContain('替代预约:AP-NEW')
dialog.vm.$emit('confirm'); await flushPromises()
@@ -179,7 +179,7 @@ describe('inbound plan and pallet move native dialogs', () => {
expect(listOverseasLocations).toHaveBeenCalledExactlyOnceWith('WH-1', { page: 1, size: 200 })
expect(dialog.get('[aria-label="移库来源"]').findAll('input')).toHaveLength(0)
expect(dialog.findAllComponents({ name: 'ElOption' }).map(option => option.props('value'))).toEqual(['N01', 'A0'])
dialog.findComponent({ name: 'ElSelect' }).vm.$emit('update:modelValue', 'A0'); await dialog.get('input[placeholder="请输入移库原因"]').setValue(' 上架到溢出位 ')
dialog.findComponent({ name: 'ElSelect' }).vm.$emit('update:modelValue', 'A0'); await dialog.get('input[aria-label="移库原因"]').setValue(' 上架到溢出位 ')
await dialog.get('button[aria-label="展开全屏"]').trigger('click'); await flushPromises()
dialog.vm.$emit('confirm'); await flushPromises()
expect(moveInboundPallet).toHaveBeenCalledExactlyOnceWith({ overseasWarehouseId: 'WH-1', sourcePalletCode: 'PALLET-1', targetLocationCode: 'A0', expectedPalletVersion: 0, reason: '上架到溢出位', idempotencyKey: expect.stringMatching(/^admin-inbound-move-PALLET-1-\d+$/) })
@@ -189,15 +189,15 @@ describe('inbound plan and pallet move native dialogs', () => {
let reject!: (reason: unknown) => void
vi.mocked(moveInboundPallet).mockReturnValue(new Promise((_, no) => { reject = no }))
const { dialog } = await openMove()
dialog.findComponent({ name: 'ElSelect' }).vm.$emit('update:modelValue', 'N01'); await dialog.get('input[placeholder="请输入移库原因"]').setValue('现场上架')
dialog.findComponent({ name: 'ElSelect' }).vm.$emit('update:modelValue', 'N01'); await dialog.get('input[aria-label="移库原因"]').setValue('现场上架')
dialog.vm.$emit('confirm'); dialog.vm.$emit('confirm'); await flushPromises()
expect(moveInboundPallet).toHaveBeenCalledTimes(1)
expect(dialog.findComponent({ name: 'ElDialog' }).props()).toMatchObject({ showClose: false, closeOnPressEscape: false })
expect(dialog.get('input[placeholder="请输入移库原因"]').attributes('disabled')).toBeDefined()
expect(dialog.get('input[aria-label="移库原因"]').attributes('disabled')).toBeDefined()
reject(new ApiResponseError('移库未完成', 'A0409', 409, null, 'move-popup-request')); await flushPromises()
expect(dialog.props('modelValue')).toBe(true)
expect(dialog.findComponent({ name: 'ElSelect' }).props('modelValue')).toBe('N01')
expect((dialog.get('input[placeholder="请输入移库原因"]').element as HTMLInputElement).value).toBe('现场上架')
expect((dialog.get('input[aria-label="移库原因"]').element as HTMLInputElement).value).toBe('现场上架')
expect(dialog.text()).toContain('move-popup-request')
})
it('keeps failed location queries explicit and retries without losing the move reason', async () => {
@@ -205,11 +205,11 @@ describe('inbound plan and pallet move native dialogs', () => {
const { dialog } = await openMove()
expect(dialog.props('confirmDisabled')).toBe(true)
expect(dialog.text()).toContain('location-popup-request')
await dialog.get('input[placeholder="请输入移库原因"]').setValue('保留原因')
await dialog.get('input[aria-label="移库原因"]').setValue('保留原因')
dialog.vm.$emit('confirm'); await flushPromises(); expect(moveInboundPallet).not.toHaveBeenCalled()
dialog.findComponent(LoadErrorState).vm.$emit('retry'); await flushPromises()
expect(listOverseasLocations).toHaveBeenCalledTimes(2)
expect((dialog.get('input[placeholder="请输入移库原因"]').element as HTMLInputElement).value).toBe('保留原因')
expect((dialog.get('input[aria-label="移库原因"]').element as HTMLInputElement).value).toBe('保留原因')
expect(dialog.findAllComponents({ name: 'ElOption' })).toHaveLength(2)
})
it('keeps server move blockers visible and does not close the form or refresh as success', async () => {