Skip to content

Commit eed6ba9

Browse files
ouuanaloisklink
authored andcommitted
test: add test for svgId option
1 parent 726b652 commit eed6ba9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src-test/test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,14 @@ describe('mermaid-cli', () => {
268268
expectBytesAreFormat(await fs.readFile(expectedOutputFile), 'png')
269269
}, timeout)
270270

271+
test('the id of <svg> can be set', async () => {
272+
const outputFile = 'test-positive/flowchart1.mmd.svg'
273+
await fs.rm(outputFile, { force: true })
274+
await promisify(execFile)('node', ['src/cli.js', '-i', 'test-positive/flowchart1.mmd', '-o', outputFile, '-I', 'custom-id'])
275+
276+
expect((await fs.readFile(outputFile)).toString()).toMatch(/^<svg[^>]+id="custom-id"/)
277+
}, timeout)
278+
271279
test.concurrent.each(['svg', 'png', 'pdf'])('should set red background to %s', async (format) => {
272280
await promisify(execFile)('node', [
273281
'src/cli.js', '-i', 'test-positive/flowchart1.mmd', '-o', `test-output/flowchart1-red-background.${format}`,

0 commit comments

Comments
 (0)