修复讲解列表展厅标题
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-22 19:44:16 +08:00
parent 4d8cc55a5c
commit 5d0c38e726
2 changed files with 23 additions and 5 deletions

View File

@@ -98,18 +98,21 @@ describe('讲解对象列表返回', () => {
wrapper.unmount()
})
it('keeps the selected hall context when an object payload omits hall fields', async () => {
it('uses the decoded hall name as the page title and detail context', async () => {
const wrapper = mountGuideStopList()
testState.onLoadHandler?.({ hallId: 'hall-1', hallName: '恐龙厅' })
testState.onLoadHandler?.({ hallId: 'hall-1', hallName: '%25E6%25BC%2594%25E5%258C%2596%25E5%258E%2585' })
await flushPromises()
expect(uni.setNavigationBarTitle).toHaveBeenCalledWith({ title: '演化厅' })
expect(document.title).toBe('演化厅')
await wrapper.get('[data-testid="detail-click"]').trigger('click')
const url = vi.mocked(uni.navigateTo).mock.calls[0]?.[0]?.url || ''
const params = new URLSearchParams(url.split('?')[1])
expect(url.split('?')[0]).toBe('/pages/exhibit/detail')
expect(params.get('hallId')).toBe('hall-1')
expect(params.get('hallName')).toBe('恐龙厅')
expect(params.get('hallName')).toBe('演化厅')
expect(params.get('targetType')).toBe('STOP')
expect(params.get('targetId')).toBe('target-1')
wrapper.unmount()