This commit is contained in:
@@ -94,7 +94,7 @@ const GuideMapShellStub = defineComponent({
|
||||
visiblePoiIds: { type: Array, default: null },
|
||||
targetFocusRequest: { type: Object, default: null }
|
||||
},
|
||||
emits: ['floor-change', 'poi-click', 'selection-clear'],
|
||||
emits: ['floor-change', 'poi-click', 'selection-clear', 'indoor-view-change'],
|
||||
setup() {
|
||||
onMounted(() => {
|
||||
testState.mapMountCount += 1
|
||||
@@ -363,6 +363,25 @@ describe('首页搜索与地图闭环', () => {
|
||||
expect(map.props('visiblePoiIds')).toEqual(categoryContext.visiblePoiIds)
|
||||
})
|
||||
|
||||
it('楼层数据按高到低返回时,首次进入仍将 1F 作为自动缩放的默认目标', async () => {
|
||||
const originalFloors = [...floors]
|
||||
floors.splice(0, floors.length,
|
||||
{ id: 'L5', label: '5F', order: 5 },
|
||||
{ id: 'L2', label: '2F', order: 2 },
|
||||
{ id: 'L1', label: '1F', order: 1 }
|
||||
)
|
||||
|
||||
try {
|
||||
const wrapper = await mountIndex()
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
|
||||
expect(map.props('activeFloor')).toBe('L1')
|
||||
expect(wrapper.getComponent(PoiSearchPanelStub).props('currentFloorId')).toBe('L1')
|
||||
} finally {
|
||||
floors.splice(0, floors.length, ...originalFloors)
|
||||
}
|
||||
})
|
||||
|
||||
it('分类结果进入详情后恢复目标楼层标准视图', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const search = wrapper.getComponent(PoiSearchPanelStub)
|
||||
@@ -606,6 +625,74 @@ describe('首页搜索与地图闭环', () => {
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.getComponent(PoiSearchPanelStub).exists()).toBe(true)
|
||||
expect(testState.searchMountCount).toBe(1)
|
||||
expect(testState.resetToViewBaselineCalls).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('直接点选普通设施后展开并关闭卡片,恢复该楼层视觉基线且不重挂载地图', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
|
||||
map.vm.$emit('poi-click', {
|
||||
...poi,
|
||||
primaryCategory: 'restroom',
|
||||
primaryCategoryZh: '卫生间'
|
||||
})
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(wrapper.find('.poi-card-collapsed').exists()).toBe(true)
|
||||
await wrapper.find('.poi-card-collapsed').trigger('tap')
|
||||
await wrapper.vm.$nextTick()
|
||||
await wrapper.find('.poi-card-close').trigger('tap')
|
||||
await flushPromises()
|
||||
|
||||
expect(testState.resetToViewBaselineCalls).toEqual([{
|
||||
view: 'floor',
|
||||
floorId: poi.floorId,
|
||||
reason: 'floor-reset'
|
||||
}])
|
||||
expect(wrapper.find('.guide-poi-card').exists()).toBe(false)
|
||||
expect(map.props('visiblePoiIds')).toBeNull()
|
||||
expect(map.props('targetFocusRequest')).toBeNull()
|
||||
expect(testState.mapMountCount).toBe(1)
|
||||
expect(testState.mapUnmountCount).toBe(0)
|
||||
})
|
||||
|
||||
it('直接点选展厅后关闭卡片,复用楼层基线复位而非详情返回语义', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
|
||||
map.vm.$emit('poi-click', {
|
||||
...poi,
|
||||
kind: 'hall',
|
||||
primaryCategory: 'exhibition_hall',
|
||||
primaryCategoryZh: '展厅'
|
||||
})
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(wrapper.find('.poi-card-close').exists()).toBe(true)
|
||||
await wrapper.find('.poi-card-close').trigger('tap')
|
||||
await flushPromises()
|
||||
|
||||
expect(testState.resetToViewBaselineCalls).toEqual([{
|
||||
view: 'floor',
|
||||
floorId: poi.floorId,
|
||||
reason: 'floor-reset'
|
||||
}])
|
||||
expect(wrapper.find('.guide-poi-card').exists()).toBe(false)
|
||||
expect(testState.mapMountCount).toBe(1)
|
||||
expect(testState.mapUnmountCount).toBe(0)
|
||||
})
|
||||
|
||||
it('renderer 清选和返回建筑外观不会触发楼层复位', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
|
||||
map.vm.$emit('poi-click', { ...poi, primaryCategory: 'restroom' })
|
||||
map.vm.$emit('selection-clear')
|
||||
map.vm.$emit('indoor-view-change', 'overview')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(testState.resetToViewBaselineCalls).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('单结果分类写入 resultCount=1,主动取消恢复默认标记并清除目标', async () => {
|
||||
|
||||
Reference in New Issue
Block a user