@@ -136,6 +136,7 @@ describe('讲解对象列表返回', () => {
|
||||
expect(params.get('hallName')).toBe('恐龙厅')
|
||||
expect(params.get('targetType')).toBe('STOP')
|
||||
expect(params.get('targetId')).toBe('target-1')
|
||||
expect(params.get('returnToGuideStopList')).toBe('1')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -192,6 +193,25 @@ describe('讲解对象列表返回', () => {
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('从展厅列表进入时,即使 H5 页面栈缺失也保留内部返回路径', async () => {
|
||||
hostEnvironmentMocks.embeddedInWechatMiniProgram = true
|
||||
miniProgramReturnMocks.returnToWechatMiniProgram.mockResolvedValue({ status: 'returned' })
|
||||
const wrapper = mountGuideStopList()
|
||||
testState.onLoadHandler?.({ hallId: 'hall-1', hallName: '恐龙厅', returnToHallList: '1' })
|
||||
await flushPromises()
|
||||
|
||||
await wrapper.get('[data-testid="detail-click"]').trigger('click')
|
||||
const detailUrl = vi.mocked(uni.navigateTo).mock.calls[0]?.[0]?.url || ''
|
||||
expect(new URLSearchParams(detailUrl.split('?')[1]).get('returnToHallList')).toBe('1')
|
||||
|
||||
await wrapper.get('[data-testid="list-back"]').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(uni.reLaunch).toHaveBeenCalledWith({ url: '/pages/explain/list' })
|
||||
expect(miniProgramReturnMocks.returnToWechatMiniProgram).not.toHaveBeenCalled()
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('页面栈返回失败时回退至独立展厅列表', async () => {
|
||||
vi.stubGlobal('getCurrentPages', vi.fn(() => [
|
||||
{ route: 'pages/explain/list', options: {} },
|
||||
|
||||
Reference in New Issue
Block a user