feat(jd): 京东数据库筛选行加「分类状态」下拉(全部/已分类/未分类)
This commit is contained in:
@@ -278,10 +278,10 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 })
|
||||
expect(jdApi.fetchJdProductCategories).toHaveBeenCalledWith(1)
|
||||
|
||||
// 第 1 个 select = 分组(既有契约不动),类目下拉紧随其后
|
||||
// 第 1 个 select = 分组(既有契约不动),第 2 个 = 分类状态(2026-11-15 增),类目下拉第 3
|
||||
const selects = wrapper.findAll('.jd-filter-row select')
|
||||
expect(selects).toHaveLength(2)
|
||||
const categorySelect = selects[1]
|
||||
expect(selects).toHaveLength(3)
|
||||
const categorySelect = selects[2]
|
||||
const optionTexts = categorySelect.findAll('option').map((o) => o.text())
|
||||
expect(optionTexts[0]).toBe('全部类目')
|
||||
expect(optionTexts).toContain('服饰内衣(120)')
|
||||
@@ -293,6 +293,24 @@ describe('京东数据库页(v1.4 Phase 5)', () => {
|
||||
expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ category: '运动户外', page: 1 })
|
||||
})
|
||||
|
||||
it('分类状态下拉:全部/已分类/未分类三档,选中即查回第一页并下发对应参数', async () => {
|
||||
const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 })
|
||||
const selects = wrapper.findAll('.jd-filter-row select')
|
||||
const scopeSelect = selects[1]
|
||||
const optionTexts = scopeSelect.findAll('option').map((o) => o.text())
|
||||
expect(optionTexts).toEqual(['全部', '已分类', '未分类'])
|
||||
|
||||
// 选「已分类」= 只看 group_id 非空的行(分类好的行想单独看时用这一档)
|
||||
await scopeSelect.setValue('grouped')
|
||||
await flushPromises()
|
||||
expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupScope: 'grouped', page: 1 })
|
||||
|
||||
// 选「未分类」= 只看 group_id 为空的行(分类好的不显示)
|
||||
await scopeSelect.setValue('ungrouped')
|
||||
await flushPromises()
|
||||
expect(jdApi.fetchJdProductList.mock.calls.at(-1)![0]).toMatchObject({ groupScope: 'ungrouped', page: 1 })
|
||||
})
|
||||
|
||||
it('重置把筛选面回空并回第一页重取', async () => {
|
||||
const wrapper = await mountWith({ items: [], total: 0, page: 1, pageSize: 20 })
|
||||
const textInputs = wrapper.findAll('.form-group input[type="text"]')
|
||||
|
||||
Reference in New Issue
Block a user