优化编号讲解布局与返回流程
- 将讲解编号置于标题上方并增强辨识度 - 编号详情返回后保留输入界面并清空原编号 - 增加页面栈丢失时恢复编号输入页的兜底逻辑 - 补充编号布局和返回流程回归测试 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: {} },
|
||||
|
||||
@@ -24,6 +24,9 @@ describe('ExplainGuideStopCatalog', () => {
|
||||
expect(wrapper.text()).toContain('图文')
|
||||
expect(wrapper.get('.stop-code').text()).toBe('编号:0231')
|
||||
expect(wrapper.findAll('.stop-code')).toHaveLength(1)
|
||||
const readyCopy = wrapper.get('.stop-card .stop-copy')
|
||||
expect(readyCopy.element.firstElementChild?.classList.contains('stop-code')).toBe(true)
|
||||
expect(readyCopy.element.lastElementChild?.classList.contains('stop-name')).toBe(true)
|
||||
expect(wrapper.text()).not.toContain('暂无内容')
|
||||
expect(wrapper.find('.hall-arrow').exists()).toBe(false)
|
||||
expect(wrapper.find('.stop-name').classes()).toContain('stop-name')
|
||||
|
||||
@@ -95,6 +95,11 @@ describe('讲解展厅选择列表', () => {
|
||||
expect(wrapper.emitted('codeSubmit')).toEqual([['0231']])
|
||||
expect(wrapper.find('.code-entry-sheet').exists()).toBe(true)
|
||||
|
||||
wrapper.vm.completeCodeEntry()
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(wrapper.find('.code-entry-sheet').exists()).toBe(true)
|
||||
expect(wrapper.findAll('.code-digit-value').map((item) => item.text())).toEqual(['', '', '', ''])
|
||||
|
||||
await wrapper.setProps({ codeSubmitting: true })
|
||||
expect(wrapper.get('.code-entry-native-input').attributes('disabled')).toBeDefined()
|
||||
expect(wrapper.get('.code-entry-action.primary').text()).toBe('正在查询')
|
||||
|
||||
Reference in New Issue
Block a user