fix: 统一馆内三维模型返回初始状态
This commit is contained in:
@@ -143,10 +143,9 @@ afterEach(() => {
|
||||
})
|
||||
|
||||
describe('点位详情实际渲染与返回闭环', () => {
|
||||
it('解析目标楼层和点位后才挂载地图,避免默认楼层中间帧', async () => {
|
||||
it('目标楼层与点位就绪后挂载位置预览,避免默认楼层中间帧', async () => {
|
||||
const wrapper = mountDetail()
|
||||
|
||||
expect(wrapper.find('[data-testid="guide-map-shell"]').exists()).toBe(false)
|
||||
expect(wrapper.get('[data-testid="facility-map-loading"]').text()).toContain('正在准备位置预览')
|
||||
|
||||
await loadDetail({
|
||||
@@ -163,7 +162,7 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('只展示真实详情字段,并向地图发送正确楼层与点位定位请求', async () => {
|
||||
it('只展示真实详情字段,并发送正确的位置预览请求', async () => {
|
||||
const wrapper = mountDetail()
|
||||
|
||||
await loadDetail({
|
||||
@@ -174,7 +173,6 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
})
|
||||
|
||||
const sheet = wrapper.get('[data-testid="facility-detail-sheet"]')
|
||||
const mapShell = wrapper.getComponent(GuideMapShellStub)
|
||||
expect(sheet.text()).toContain('二层卫生间')
|
||||
expect(sheet.text()).toContain('类别洗手间')
|
||||
expect(sheet.text()).toContain('楼层2F')
|
||||
@@ -182,10 +180,11 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
expect(sheet.text()).not.toContain('展示点位')
|
||||
expect(sheet.text()).not.toContain('已在对应楼层模型中标出点位')
|
||||
expect(wrapper.find('.detail-restore').exists()).toBe(false)
|
||||
const mapShell = wrapper.getComponent(GuideMapShellStub)
|
||||
expect(mapShell.props('activeFloor')).toBe('floor-l2')
|
||||
expect(mapShell.props('targetFocusRequest')).toMatchObject({
|
||||
poiId: 'poi-restroom-l2',
|
||||
floorId: 'floor-l2',
|
||||
poiId: facilityPoi.id,
|
||||
floorId: facilityPoi.floorId,
|
||||
positionGltf: [12, 3, -8]
|
||||
})
|
||||
})
|
||||
@@ -223,7 +222,7 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
expect(uni.reLaunch).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('搜索单结果关闭详情后回到首页', async () => {
|
||||
it('搜索单结果关闭详情同样仅使用页面栈返回', async () => {
|
||||
const wrapper = mountDetail()
|
||||
await loadDetail({
|
||||
source: 'search',
|
||||
@@ -234,8 +233,8 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
|
||||
await wrapper.get('[data-testid="facility-detail-close"]').trigger('tap')
|
||||
|
||||
expect(uni.reLaunch).toHaveBeenCalledWith({ url: '/pages/index/index' })
|
||||
expect(uni.navigateBack).not.toHaveBeenCalled()
|
||||
expect(uni.navigateBack).toHaveBeenCalledWith(expect.objectContaining({ delta: 1 }))
|
||||
expect(uni.reLaunch).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('直接进入详情时使用常规返回', async () => {
|
||||
@@ -248,11 +247,10 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
expect(uni.reLaunch).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('地图报告点位缺失或定位失败时显示面向用户的错误反馈', async () => {
|
||||
it('位置预览失败时显示面向用户的错误反馈', async () => {
|
||||
const wrapper = mountDetail()
|
||||
await loadDetail({ id: facilityPoi.id, target: facilityPoi.name })
|
||||
const mapShell = wrapper.getComponent(GuideMapShellStub)
|
||||
|
||||
mapShell.vm.$emit('target-focus', {
|
||||
requestId: 1,
|
||||
poiId: facilityPoi.id,
|
||||
@@ -260,18 +258,7 @@ describe('点位详情实际渲染与返回闭环', () => {
|
||||
status: 'missing'
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.get('[data-testid="facility-location-error"]').text())
|
||||
.toContain('缺少可用的位置数据')
|
||||
|
||||
mapShell.vm.$emit('target-focus', {
|
||||
requestId: 1,
|
||||
poiId: facilityPoi.id,
|
||||
floorId: facilityPoi.floorId,
|
||||
status: 'error'
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.get('[data-testid="facility-location-error"]').text())
|
||||
.toContain('地图定位暂不可用')
|
||||
expect(wrapper.get('[data-testid="facility-location-error"]').text()).toContain('缺少可用的位置数据')
|
||||
})
|
||||
|
||||
it('位置数据源加载失败时提供明确重试反馈', async () => {
|
||||
|
||||
@@ -321,7 +321,7 @@ describe('首页搜索与地图闭环', () => {
|
||||
expect(map.props('visiblePoiIds')).toEqual(categoryContext.visiblePoiIds)
|
||||
})
|
||||
|
||||
it('分类结果进入详情时不触发首页地图,返回后才恢复目标焦点与楼层', async () => {
|
||||
it('分类结果进入详情后统一恢复首页模型初始状态', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const search = wrapper.getComponent(PoiSearchPanelStub)
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
@@ -354,17 +354,14 @@ describe('首页搜索与地图闭环', () => {
|
||||
await testState.onShowHandler?.()
|
||||
await flushPromises()
|
||||
|
||||
expect(testState.searchCollapseAfterDetailCount).toBe(1)
|
||||
expect(testState.searchResetCount).toBeGreaterThan(0)
|
||||
expect(testState.searchRestoreCount).toBe(0)
|
||||
expect(map.props('activeFloor')).toBe('L2')
|
||||
expect(map.props('activeFloor')).toBe('L1')
|
||||
expect(map.props('visiblePoiIds')).toBeNull()
|
||||
expect(map.props('targetFocusRequest')).toMatchObject({
|
||||
poiId: poi.id,
|
||||
floorId: 'L2'
|
||||
})
|
||||
expect(map.props('targetFocusRequest')).toBeNull()
|
||||
})
|
||||
|
||||
it('全屏搜索结果进入详情并返回后同样恢复为收缩态', async () => {
|
||||
it('全屏搜索结果进入详情并返回后同样恢复为默认收缩态', async () => {
|
||||
const wrapper = await mountIndex()
|
||||
const search = wrapper.getComponent(PoiSearchPanelStub)
|
||||
const map = wrapper.getComponent(GuideMapShellStub)
|
||||
@@ -379,10 +376,10 @@ describe('首页搜索与地图闭环', () => {
|
||||
await testState.onShowHandler?.()
|
||||
await flushPromises()
|
||||
|
||||
expect(testState.searchCollapseAfterDetailCount).toBe(1)
|
||||
expect(testState.searchResetCount).toBeGreaterThan(0)
|
||||
expect(testState.searchRestoreCount).toBe(0)
|
||||
expect(map.props('visiblePoiIds')).toBeNull()
|
||||
expect(map.props('targetFocusRequest')).toMatchObject({ poiId: poi.id })
|
||||
expect(map.props('targetFocusRequest')).toBeNull()
|
||||
})
|
||||
|
||||
it('页面重新显示时要求搜索面板恢复原列表位置', async () => {
|
||||
|
||||
Reference in New Issue
Block a user