mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
修复mermaid渲染遗漏了 /(斜杠
修复mermaid渲染遗漏了 /(斜杠
This commit is contained in:
parent
83f8c66233
commit
3e7c7de54a
@ -58,6 +58,24 @@ describe('MermaidRenderer Mermaid integration', () => {
|
||||
expect(surface.innerHTML).not.toContain('onerror')
|
||||
})
|
||||
|
||||
it('auto-quotes flowchart labels containing forward slashes to avoid lexical errors', async () => {
|
||||
render(
|
||||
<MermaidRenderer
|
||||
code={[
|
||||
'flowchart TD',
|
||||
' D1[/api/dcl] --> D2[直接调用 dclService]',
|
||||
' D2 --> R[返回结果]',
|
||||
].join('\n')}
|
||||
/>,
|
||||
)
|
||||
|
||||
const surface = await screen.findByTestId('mermaid-diagram-surface')
|
||||
|
||||
expect(surface).toHaveTextContent('/api/dcl')
|
||||
expect(surface).toHaveTextContent('直接调用 dclService')
|
||||
expect(screen.queryByText('Mermaid Error')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders generated flowchart labels with HTML breaks and structural characters', async () => {
|
||||
render(
|
||||
<MermaidRenderer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user