This commit is contained in:
2026-08-14 14:27:03 +08:00
parent 724848feb6
commit a81af4a664
64 changed files with 961 additions and 176 deletions
@@ -257,6 +257,25 @@ describe('WarehousesView', () => {
})
})
it('submits the current keyword once when Enter is pressed in the text filter', async () => {
const wrapper = await mountView()
const keywordInput = wrapper.find('input[placeholder="仓库名称、编码、城市或地址"]')
await keywordInput.setValue('AKR1')
await keywordInput.trigger('keyup', { key: 'Enter' })
await flushPromises()
expect(listPlatformWarehouses).toHaveBeenCalledTimes(2)
expect(listPlatformWarehouses).toHaveBeenLastCalledWith({
page: 1,
size: 20,
keyword: 'AKR1',
warehouseType: undefined,
status: undefined,
})
expect(wrapper.findComponent(QueryToolbar).props('loading')).toBe(false)
})
it('shows a recoverable API error without falling back to demo warehouses', async () => {
vi.mocked(listPlatformWarehouses).mockRejectedValueOnce(new Error('Gateway unavailable'))
const wrapper = await mountView()
@@ -672,7 +672,7 @@ onMounted(() => void loadWarehouses())
<AdminPage as="div">
<ListPageLayout aria-label="仓库列表页面">
<template #toolbar>
<QueryToolbar v-model="filters" class="surface-panel" ariaLabel="仓库筛选" :fields="queryFields" preference-key="warehouses-query" @search="queryWarehouses" />
<QueryToolbar v-model="filters" class="surface-panel" ariaLabel="仓库筛选" :fields="queryFields" :loading="loading" preference-key="warehouses-query" @search="queryWarehouses" />
</template>
<template v-if="loadError" #state>
<LoadErrorState