- commit
- 05c35554c804c8b0cb077d5687759cdff3913970
- parent
- 1588ec7b5a2e436d6b9ad602e74e2230aff4c60e
- author
- Dami <dami.etoile@gmail.com>
| M | renderers/ | 9 | +++++++++ |
@@ -1,4 +1,7 @@
11 import { describe, expect, it } from 'vitest'2+import { readFileSync } from 'node:fs'3+import { fileURLToPath } from 'node:url'4+import { dirname, resolve } from 'node:path'25 import { FRAME_URLS, RenderInputError, validateRenderRequest } from '../src/contracts'36 47 describe('browser-run render contract', () => {@@ -13,4 +16,10 @@ describe('browser-run render contract', () => {
1316 expect(() => validateRenderRequest({ engine: 'mermaid', requestId: 'r bad', source: '' })).toThrow(RenderInputError)1417 expect(() => validateRenderRequest({ engine: 'mermaid', requestId: 'r', source: 'x'.repeat(524_289) })).toThrow(/512 KiB/)1518 })19+20+ it('pins Mermaid to SVG labels and protects that setting from directives', () => {21+ const frame = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../frames/mermaid/src/frame.js'), 'utf8')22+ expect(frame).toMatch(/htmlLabels:\s*false/)23+ expect(frame).toMatch(/secure:\s*\[[\s\S]*['"]htmlLabels['"]/) 24+ })1625 })