import { expect, it, vi } from 'vitest' import { mount } from '@vue/test-utils' import ElementPlus from 'element-plus' import Content from '@/components/BusinessAssistant/AssistantNoticeContent.vue' import { safeNoticeHtml } from '@/utils/assistant-notice' vi.mock('@/components/Editor/index.vue', () => ({ default: { name: 'NoticeEditorFixture', props: ['modelValue', 'readOnly'], emits: ['update:modelValue'], template: '' } })) it('previews text and real tutorial images without exposing model HTML as plain source', () => { const row = { noticeTitle: '反馈使用说明', noticeType: '1', noticeContent: '
填写标题和说明
原文
' }, editable: true }, global: { plugins: [ElementPlus] } }) await wrapper.findAll('input[type="radio"]')[1].setValue(true) await wrapper.find('textarea').setValue('新内容
') expect(wrapper.emitted('change')[0][0]).toEqual({ key: 'noticeContent', value: '新内容
' }) await wrapper.setProps({ busy: true }) await wrapper.find('textarea').setValue('忙时不改
') expect(wrapper.emitted('change')).toHaveLength(1) await wrapper.setProps({ editable: false }) expect(wrapper.find('textarea').exists()).toBe(false) expect(wrapper.find('.el-radio-group').exists()).toBe(false) wrapper.unmount() }) it('never renders scripts, inline handlers, CSS overlays, embedded frames or unsafe image/link schemes', () => { const html = safeNoticeHtml('说明
