优化编号讲解布局与返回流程
- 将讲解编号置于标题上方并增强辨识度 - 编号详情返回后保留输入界面并清空原编号 - 增加页面栈丢失时恢复编号输入页的兜底逻辑 - 补充编号布局和返回流程回归测试 Made-with: Proma
This commit is contained in:
@@ -465,6 +465,40 @@ describe('讲解详情音频优先布局', () => {
|
||||
expect(mocks.toggleMute).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('编号入口详情返回时回到原编号输入页', async () => {
|
||||
vi.stubGlobal('getCurrentPages', vi.fn(() => [
|
||||
{ route: 'pages/explain/list', options: {} },
|
||||
{ route: 'pages/exhibit/detail', options: { entry: 'code' } }
|
||||
]))
|
||||
const wrapper = mount(ExhibitDetail, {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, stopId: 'stop-1', entry: 'code' })
|
||||
await flushPromises()
|
||||
|
||||
wrapper.getComponent(GuidePageFrameStub).vm.$emit('back')
|
||||
await flushPromises()
|
||||
|
||||
expect(uni.navigateBack).toHaveBeenCalledWith(expect.objectContaining({ delta: 1 }))
|
||||
expect(uni.redirectTo).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('编号入口详情丢失页面栈时回退到自动打开的编号输入页', async () => {
|
||||
const wrapper = mount(ExhibitDetail, {
|
||||
global: { stubs: { GuidePageFrame: GuidePageFrameStub } }
|
||||
})
|
||||
await mocks.onLoadHandler?.({ id: exhibit.id, stopId: 'stop-1', entry: 'code' })
|
||||
await flushPromises()
|
||||
|
||||
wrapper.getComponent(GuidePageFrameStub).vm.$emit('back')
|
||||
await flushPromises()
|
||||
|
||||
expect(uni.navigateBack).not.toHaveBeenCalled()
|
||||
expect(uni.redirectTo).toHaveBeenCalledWith(expect.objectContaining({
|
||||
url: '/pages/explain/list?codeEntry=1'
|
||||
}))
|
||||
})
|
||||
|
||||
it('上一页是讲解对象列表时使用页面栈返回', async () => {
|
||||
vi.stubGlobal('getCurrentPages', vi.fn(() => [
|
||||
{ route: 'pages/explain/guide-stop-list', options: {} },
|
||||
|
||||
Reference in New Issue
Block a user