|
|
@@ -68,7 +68,7 @@ describe('Markdown file cards', () => {
|
|
|
const wrapper = mount(MarkdownContent, { props: { fileCards: true, content: [
|
|
|
'[外部](https://example.com/Users/samien/.hermes/workspace/report.md)',
|
|
|
'[普通](https://example.com/report.md)',
|
|
|
- '[配置](/Users/samien/.hermes/config.yaml)',
|
|
|
+ '[config.yaml](/Users/samien/.hermes/config.yaml)',
|
|
|
'[未知](sandbox:/etc/passwd)',
|
|
|
].join('\n\n') } })
|
|
|
expect(wrapper.findAll('.file-link-card')).toHaveLength(1)
|
|
|
@@ -78,6 +78,20 @@ describe('Markdown file cards', () => {
|
|
|
wrapper.unmount()
|
|
|
})
|
|
|
|
|
|
+ it('keeps descriptive file links as ordinary links instead of file cards', () => {
|
|
|
+ const wrapper = mount(MarkdownContent, { props: { fileCards: true, content: [
|
|
|
+ '[源程序鉴别材料|Word](/Users/samien/.hermes/workspace/源程序鉴别材料.docx)',
|
|
|
+ '[源程序鉴别材料|PDF](/Users/samien/.hermes/workspace/源程序鉴别材料.pdf)',
|
|
|
+ '[信息采集表|数值修订待确认](/Users/samien/.hermes/workspace/信息采集表.xlsx)',
|
|
|
+ '[修改说明与验证结果](/Users/samien/.hermes/workspace/修改说明.md)',
|
|
|
+ ].join('\n\n') } })
|
|
|
+
|
|
|
+ expect(wrapper.findAll('.file-link-card')).toHaveLength(0)
|
|
|
+ expect(wrapper.findAll('a')).toHaveLength(4)
|
|
|
+ expect(wrapper.findAll('a').every(link => link.attributes('target') === '_blank')).toBe(true)
|
|
|
+ wrapper.unmount()
|
|
|
+ })
|
|
|
+
|
|
|
it('decorates workspace links arriving in a later message update', async () => {
|
|
|
const wrapper = mount(MarkdownContent, { props: { content: '附件如下:', fileCards: true } })
|
|
|
await wrapper.setProps({ content: '附件如下:\n\n[报告.md](/Users/samien/.hermes/workspace/report.md)' })
|
|
|
@@ -171,7 +185,7 @@ describe('streaming Markdown', () => {
|
|
|
})
|
|
|
|
|
|
it('renders process media as text while retaining message media previews', async () => {
|
|
|
- const content = ' [过程文件](/Users/test/Agents/process.pdf)'
|
|
|
+ const content = ' [process.pdf](/Users/test/Agents/process.pdf)'
|
|
|
const process = mount(MarkdownContent, { props: { content, processContent: true, fileCards: true } })
|
|
|
await nextTick()
|
|
|
expect(process.find('img').exists()).toBe(false)
|