调整馆内点位搜索状态流转
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-13 23:51:27 +08:00
parent 350491157a
commit 2a274aebcf
4 changed files with 186 additions and 6 deletions

View File

@@ -130,6 +130,91 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
pageWrapper.unmount()
})
it('展开态快捷入口退出全屏并进入当前楼层的分类结果', async () => {
const wrapper = mount(PoiSearchPanel, {
props: {
variant: 'home',
currentFloorId: 'floor-1',
currentFloorLabel: '1F'
}
})
await flushMountedSearch()
await wrapper.get('.search-box').trigger('tap')
await flushMountedSearch()
expect(wrapper.find('.poi-search-content').exists()).toBe(true)
await wrapper.get('[data-testid="poi-category-restroom"]').trigger('tap')
await flushMountedSearch()
expect(wrapper.find('.poi-search-content').exists()).toBe(false)
expect(wrapper.find('[data-testid="poi-home-category-results"]').exists()).toBe(true)
expect(wrapper.get('[data-testid="poi-home-category-results"]').text())
.toContain('当前楼层 1F · 2 个点位')
expect(uni.hideKeyboard).toHaveBeenCalled()
expect((wrapper.emitted('results-change') || []).at(-1)?.[0]).toMatchObject({
active: true,
categoryId: 'restroom',
floorId: 'floor-1',
visiblePoiIds: ['restroom-1']
})
wrapper.unmount()
})
it('关键词确认命中分类时仍保留全屏搜索结果', async () => {
const wrapper = mount(PoiSearchPanel, {
props: {
variant: 'home',
currentFloorId: 'floor-1',
currentFloorLabel: '1F'
}
})
await flushMountedSearch()
await wrapper.get('.search-box').trigger('tap')
await wrapper.get('.search-input').trigger('confirm', {
detail: { value: '洗手间' }
})
await flushMountedSearch()
expect(wrapper.find('.poi-search-content').exists()).toBe(true)
expect(wrapper.find('[data-testid="poi-home-category-results"]').exists()).toBe(false)
wrapper.unmount()
})
it('详情返回专用复位恢复默认快捷入口并清空搜索状态', async () => {
const wrapper = mount(PoiSearchPanel, {
props: {
variant: 'home',
currentFloorId: 'floor-1',
currentFloorLabel: '1F'
}
})
await flushMountedSearch()
await wrapper.get('[data-testid="poi-category-restroom"]').trigger('tap')
await flushMountedSearch()
wrapper.get('[data-testid="poi-result-list"]').element.scrollTop = 126
await (wrapper.vm as unknown as {
returnToCollapsedAfterDetail: () => Promise<void>
}).returnToCollapsedAfterDetail()
await flushMountedSearch()
expect(wrapper.find('[data-testid="poi-home-category-results"]').exists()).toBe(false)
expect(wrapper.find('.poi-search-content').exists()).toBe(false)
expect(wrapper.findAll('.home-category-chip')).toHaveLength(5)
expect(wrapper.findAll('.home-category-chip.active')).toHaveLength(0)
expect((wrapper.get('.search-input').element as HTMLInputElement).value).toBe('')
expect((wrapper.emitted('results-change') || []).at(-1)?.[0]).toMatchObject({
active: false,
keyword: '',
categoryId: '',
visiblePoiIds: [],
listScrollTop: 0
})
wrapper.unmount()
})
it('首页分类只展示当前楼层结果,并上报可定位点位的精确 marker ID', async () => {
const wrapper = mount(PoiSearchPanel, {
props: {
@@ -210,7 +295,7 @@ describe('POI 搜索面板实际渲染与状态闭环', () => {
await flushMountedSearch()
expect(wrapper.get('[data-testid="poi-empty"]').text()).toContain('当前楼层暂无匹配点位')
expect((wrapper.emitted('results-change') || []).at(-1)?.[0]).toMatchObject({
active: false,
active: true,
visiblePoiIds: []
})
wrapper.unmount()