适配H5讲解统一详情接口
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-08-05 14:52:36 +08:00
parent c287ef3a2a
commit 2edb6bd9f2
25 changed files with 946 additions and 1148 deletions

View File

@@ -295,7 +295,7 @@ describe('讲解详情音频优先布局', () => {
expect(wrapper.find('.detail-audio-status').exists()).toBe(false)
})
it('播放失败显示错误并通过既有刷新链路重试', async () => {
it('播放失败显示错误并从当前详情音轨重试', async () => {
audioState.currentAudio.value = { id: 'audio-1', audioUrl: exhibit.audioUrl }
audioState.currentSource.value = { targetType: 'STOP', targetId: 'stop-1', lang: 'en-US' }
audioState.error.value = '音频暂时无法播放'
@@ -316,7 +316,10 @@ describe('讲解详情音频优先布局', () => {
await wrapper.get('.detail-audio-play').trigger('tap')
await flushPromises()
expect(mocks.selectAudioForExplainDetail).toHaveBeenCalledWith(expect.any(Object), { refreshPlayInfo: true })
expect(mocks.selectAudioForExplainDetail).toHaveBeenCalledWith(expect.objectContaining({
id: exhibit.id,
guideVersion: 'standard'
}))
expect(mocks.play).toHaveBeenCalledWith(expect.objectContaining({ id: 'audio-refresh' }), expect.objectContaining({
retryOnError: expect.any(Function),
displayMode: 'mini'
@@ -349,13 +352,13 @@ describe('讲解详情音频优先布局', () => {
await flushPromises()
expect(wrapper.get('.detail-audio-speed').text()).toBe('1.0')
expect(wrapper.get('.detail-audio-voice').attributes('aria-label')).toBe('切换为声讲解')
expect(wrapper.get('.detail-audio-voice').attributes('aria-label')).toBe('切换为声讲解')
await wrapper.get('.detail-audio-speed').trigger('tap')
await wrapper.get('.detail-audio-voice').trigger('tap')
expect(mocks.setPlaybackRate).toHaveBeenCalledWith(1.25)
expect(wrapper.get('.detail-audio-voice').attributes('aria-label')).toBe('切换为声讲解')
expect(wrapper.get('.detail-audio-voice').attributes('aria-label')).toBe('切换为声讲解')
expect(mocks.toggleMute).not.toHaveBeenCalled()
})
@@ -407,9 +410,6 @@ describe('讲解详情音频优先布局', () => {
})
await flushPromises()
vi.mocked(uni.navigateBack).mockImplementationOnce((options: any) => {
options.fail?.()
})
wrapper.getComponent(GuidePageFrameStub).vm.$emit('back')
await flushPromises()
@@ -418,6 +418,6 @@ describe('讲解详情音频优先布局', () => {
expect(url.split('?')[0]).toBe('/pages/explain/guide-stop-list')
expect(params.get('hallId')).toBe('hall-1')
expect(params.get('hallName')).toBe('恐龙厅')
expect(uni.navigateBack).toHaveBeenCalledWith(expect.objectContaining({ delta: 1 }))
expect(uni.navigateBack).not.toHaveBeenCalled()
})
})