优化讲解展厅与对象列表视觉
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-18 01:16:30 +08:00
parent b8ab414bac
commit 5a711377b0
16 changed files with 161 additions and 121 deletions

View File

@@ -13,29 +13,26 @@ const stops = [
const mountCatalog = () => mount(ExplainGuideStopCatalog, { props: { guideStops: stops, selectedHallName: '宇宙厅', hasMore: true } })
describe('ExplainGuideStopCatalog', () => {
it('renders a stable single-column list with real availability copy and no arrows', () => {
it('renders a stable single-column list with one truthful availability tag and no arrows', () => {
const wrapper = mountCatalog()
expect(wrapper.find('.stop-list').exists()).toBe(true)
expect(wrapper.find('.stop-grid').exists()).toBe(false)
expect(wrapper.findAll('.stop-card')).toHaveLength(3)
expect(wrapper.findAll('.stop-cover.placeholder')).toHaveLength(2)
expect(wrapper.text()).toContain('音频可播放')
expect(wrapper.text()).toContain('图文可查看')
expect(wrapper.text()).toContain('暂无可用内容')
expect(wrapper.findAll('.stop-status')).toHaveLength(3)
expect(wrapper.text()).toContain('音频')
expect(wrapper.text()).toContain('图文')
expect(wrapper.text()).toContain('暂无内容')
expect(wrapper.find('.hall-arrow').exists()).toBe(false)
expect(wrapper.find('.stop-name').classes()).toContain('stop-name')
})
it('searches and uses only data-driven fallback filters when guide levels are absent', async () => {
it('does not expose search or category controls in the focused list', () => {
const wrapper = mountCatalog()
expect(wrapper.text()).not.toContain('核心展品')
expect(wrapper.get('input').attributes('placeholder')).toBe('搜索讲解对象')
await wrapper.get('input').setValue('图文')
expect(wrapper.findAll('.stop-card')).toHaveLength(1)
expect(wrapper.emitted('requestAll')).toHaveLength(1)
await wrapper.get('input').setValue('')
await wrapper.get('.filter-chip:nth-child(2)').trigger('tap')
expect(wrapper.findAll('.stop-card')).toHaveLength(1)
expect(wrapper.find('input').exists()).toBe(false)
expect(wrapper.find('.catalog-controls').exists()).toBe(false)
expect(wrapper.find('.filter-chip').exists()).toBe(false)
})
it('keeps loading and empty states available for the single-column list', async () => {
@@ -47,14 +44,12 @@ describe('ExplainGuideStopCatalog', () => {
expect(wrapper.find('.stop-list').exists()).toBe(false)
})
it('emits card, back, retry, retry-more, and request-all actions', async () => {
it('emits card, back, retry, and retry-more actions', async () => {
const wrapper = mountCatalog()
await wrapper.get('.stop-card').trigger('tap')
await wrapper.get('.header-back').trigger('tap')
await wrapper.get('.filter-chip:nth-child(2)').trigger('tap')
expect(wrapper.emitted('guideStopClick')?.[0][0]).toMatchObject({ id: 'ready' })
expect(wrapper.emitted('back')).toHaveLength(1)
expect(wrapper.emitted('requestAll')).toHaveLength(1)
await wrapper.setProps({ error: '失败' })
await wrapper.get('.state-retry').trigger('tap')