Files
his/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts
2026-05-27 07:27:48 +08:00

47 lines
1.7 KiB
TypeScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
// 假设已引入相关组件与API Mock
// import ExamApply from '@/views/outpatient/ExamApply.vue'
describe('历史回归测试集', () => {
it('应正常加载门诊队列列表', () => {
expect(true).toBe(true)
})
})
describe('Bug #550: 检查申请项目选择交互优化', { tags: ['@bug550', '@regression'] }, () => {
it('应解耦项目与检查方法的勾选,已选卡片默认收起且正确显示层级', () => {
// 1. 模拟勾选项目
const item = { id: 1, name: '套餐128线排', selected: true, methods: [{ id: 101, name: '常规扫描', selected: false }] }
const selected = []
// 模拟 handleItemCheck 逻辑
if (item.selected) {
selected.push({
...item,
name: item.name.replace(/^套餐[:]/, '').replace(/套餐$/, ''), // 清理前缀
isExpanded: false, // 默认收起
methods: item.methods.map(m => ({ ...m, selected: false })) // 方法不自动勾选
})
}
// 验证解耦:方法未被自动勾选
expect(selected[0].methods[0].selected).toBe(false)
// 验证名称清理
expect(selected[0].name).toBe('128线排')
// 验证默认收起
expect(selected[0].isExpanded).toBe(false)
// 验证层级结构存在
expect(selected[0].methods).toBeDefined()
expect(Array.isArray(selected[0].methods)).toBe(true)
})
it('点击已选卡片应切换展开/收起状态', () => {
const sel = { id: 1, name: '128线排', isExpanded: false }
sel.isExpanded = !sel.isExpanded
expect(sel.isExpanded).toBe(true)
sel.isExpanded = !sel.isExpanded
expect(sel.isExpanded).toBe(false)
})
})