import { describe, it, expect } from 'vitest'; import { mount } from '@vue/test-utils'; import ExamItemSelector from '@/views/outpatient/examination/components/ExamItemSelector.vue'; describe('HIS Regression Tests', () => { // ... 其他历史回归测试用例 ... /** * @bug550 @regression * 验证:检查申请项目选择交互优化 * 1. 项目与方法勾选解耦 * 2. 去除“套餐”前缀,支持名称完整提示 * 3. 默认收起明细,严格遵循 项目 > 方法 层级 */ describe('Bug #550: 检查申请项目选择交互优化', () => { it('should decouple item and method selection, display full names, and show hierarchical details', async () => { const wrapper = mount(ExamItemSelector); // 模拟传入包含套餐和方法的数据 const mockData = { id: 101, name: '套餐:128线排彩超检查', methods: [ { id: 201, name: '常规腹部扫描', checked: false }, { id: 202, name: '血管多普勒', checked: false } ] }; await wrapper.vm.addItem(mockData); await wrapper.vm.$nextTick(); const card = wrapper.find('.selected-card'); expect(card.exists()).toBe(true); // 1. 验证解耦:勾选项目不应自动勾选检查方法 const itemCheckbox = card.find('.item-checkbox input'); await itemCheckbox.setValue(true); const methodCheckboxes = card.findAll('.method-checkbox input'); expect(methodCheckboxes[0].element.checked).toBe(false); expect(methodCheckboxes[1].element.checked).toBe(false); // 2. 验证显示:去除“套餐”前缀,支持完整名称提示 const nameSpan = card.find('.item-name'); expect(nameSpan.text()).toBe('128线排彩超检查'); expect(nameSpan.attributes('title')).toBe('128线排彩超检查'); // 3. 验证层级:默认收起,点击展开显示明细 const methodList = card.find('.method-list'); expect(methodList.isVisible()).toBe(false); // 默认收起 await card.find('.expand-btn').trigger('click'); expect(methodList.isVisible()).toBe(true); expect(methodList.findAll('.method-item').length).toBe(2); }); }); });