This commit is contained in:
@@ -9,38 +9,30 @@ vi.mock('@/utils/hostEnvironment', () => ({
|
||||
}))
|
||||
|
||||
describe('讲解展厅选择列表', () => {
|
||||
it('业务单元卡片不显示业务单元标签,并保留讲解数量和点击事件', async () => {
|
||||
it('展厅卡片只显示讲解对象数量,不暴露业务单元契约', async () => {
|
||||
const wrapper = mount(ExplainHallSelect, {
|
||||
props: {
|
||||
stage: 'unit',
|
||||
businessUnits: [
|
||||
stage: 'hall',
|
||||
halls: [
|
||||
{
|
||||
id: 'unit-evolution',
|
||||
name: '生命演化',
|
||||
hallId: 'hall-evolution',
|
||||
guideStopCount: 6
|
||||
},
|
||||
{
|
||||
id: 'unit-dinosaur',
|
||||
name: '恐龙世界',
|
||||
hallId: 'hall-dinosaur',
|
||||
guideStopCount: 4
|
||||
id: 'hall-evolution',
|
||||
name: '生命演化厅',
|
||||
explainCount: 6,
|
||||
guideStopCount: 6,
|
||||
searchText: '生命演化厅'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const cards = wrapper.findAll('.unit-card')
|
||||
expect(cards).toHaveLength(2)
|
||||
expect(wrapper.text()).toContain('生命演化')
|
||||
expect(wrapper.text()).toContain('恐龙世界')
|
||||
expect(wrapper.text()).toContain('6 个讲解')
|
||||
expect(wrapper.text()).toContain('4 个讲解')
|
||||
expect(cards.map((card) => card.text()).join('')).not.toContain('业务单元')
|
||||
expect(cards[0]?.find('.floor-badge').exists()).toBe(false)
|
||||
const cards = wrapper.findAll('.hall-card')
|
||||
expect(cards).toHaveLength(1)
|
||||
expect(wrapper.text()).toContain('生命演化厅')
|
||||
expect(wrapper.text()).toContain('6 个讲解对象')
|
||||
expect(wrapper.text()).not.toContain('业务单元')
|
||||
|
||||
await cards[0]?.trigger('tap')
|
||||
expect(wrapper.emitted('businessUnitClick')).toEqual([['unit-evolution']])
|
||||
expect(wrapper.emitted('hallClick')).toEqual([['hall-evolution']])
|
||||
})
|
||||
|
||||
it('READY 讲解点不显示可讲解标签,非 READY 讲解点保留图文标签和点击事件', async () => {
|
||||
|
||||
Reference in New Issue
Block a user