@@ -411,6 +411,34 @@ describe('讲解详情音频优先布局', () => {
|
||||
expect(uni.redirectTo).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('从讲解对象列表进入时,即使 H5 页面栈缺失也回到对象列表', async () => {
|
||||
mocks.embeddedInWechatMiniProgram = true
|
||||
mocks.returnToWechatMiniProgram.mockResolvedValue({ status: 'returned' })
|
||||
const wrapper = mount(ExhibitDetail, {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
|
||||
await mocks.onLoadHandler?.({
|
||||
id: exhibit.id,
|
||||
targetType: 'STOP',
|
||||
targetId: 'stop-1',
|
||||
hallId: 'hall-1',
|
||||
hallName: '恐龙厅',
|
||||
returnToGuideStopList: '1',
|
||||
returnToHallList: '1'
|
||||
})
|
||||
wrapper.getComponent(GuidePageFrameStub).vm.$emit('back')
|
||||
await flushPromises()
|
||||
|
||||
const url = vi.mocked(uni.redirectTo).mock.calls[0]?.[0]?.url || ''
|
||||
const params = new URLSearchParams(url.split('?')[1])
|
||||
expect(url.split('?')[0]).toBe('/pages/explain/guide-stop-list')
|
||||
expect(params.get('hallId')).toBe('hall-1')
|
||||
expect(params.get('returnToHallList')).toBe('1')
|
||||
expect(mocks.returnToWechatMiniProgram).not.toHaveBeenCalled()
|
||||
expect(uni.navigateBack).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('离开详情页时立即关闭当前讲解播放器', async () => {
|
||||
audioState.currentAudio.value = { id: 'audio-1', audioUrl: exhibit.audioUrl }
|
||||
audioState.currentSource.value = { targetType: 'STOP', targetId: 'stop-1', lang: 'en-US' }
|
||||
|
||||
Reference in New Issue
Block a user