Skip to content

Commit

Permalink
test: add test for svgId option
Browse files Browse the repository at this point in the history
  • Loading branch information
ouuan committed Feb 9, 2024
1 parent b2bdb4a commit 95916a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src-test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ describe('mermaid-cli', () => {
expectBytesAreFormat(await fs.readFile(expectedOutputFile), 'png')
}, timeout)

test('the id of <svg> can be set', async () => {
const outputFile = 'test-positive/flowchart1.mmd.svg'
await fs.rm(outputFile, { force: true })
await promisify(execFile)('node', ['src/cli.js', '-i', 'test-positive/flowchart1.mmd', '-o', outputFile, '-I', 'custom-id'])

expect((await fs.readFile(outputFile)).toString()).toMatch(/^<svg[^>]+id="custom-id"/)
}, timeout)

test.concurrent.each(['svg', 'png', 'pdf'])('should set red background to %s', async (format) => {
await promisify(execFile)('node', [
'src/cli.js', '-i', 'test-positive/flowchart1.mmd', '-o', `test-output/flowchart1-red-background.${format}`,
Expand Down

0 comments on commit 95916a2

Please sign in to comment.