mirror of https://github.com/TriliumNext/Notes
fix(mermaid): <br> breaking diagram rendering (closes #1345)
parent
e795caa2f3
commit
a162fbfe42
@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { postprocessMermaidSvg } from "./mermaid.js";
|
||||
import { trimIndentation } from "../../../../spec/support/utils.js";
|
||||
|
||||
describe("Mermaid", () => {
|
||||
it("converts <br> properly", () => {
|
||||
const before = trimIndentation`\
|
||||
<g transform="translate(-55.71875, -24)" style="color:black !important" class="label">
|
||||
<rect></rect>
|
||||
<foreignObject height="48" width="111.4375">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml"
|
||||
style="color: black !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;">
|
||||
<span class="nodeLabel" style="color:black !important">
|
||||
<p>Verify Output<br>Against<BR > Criteria</p>
|
||||
</span>
|
||||
</div>
|
||||
</foreignObject>
|
||||
</g>
|
||||
`;
|
||||
const after = trimIndentation`\
|
||||
<g transform="translate(-55.71875, -24)" style="color:black !important" class="label">
|
||||
<rect></rect>
|
||||
<foreignObject height="48" width="111.4375">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml"
|
||||
style="color: black !important; display: table-cell; white-space: nowrap; line-height: 1.5; max-width: 200px; text-align: center;">
|
||||
<span class="nodeLabel" style="color:black !important">
|
||||
<p>Verify Output<br/>Against<br/> Criteria</p>
|
||||
</span>
|
||||
</div>
|
||||
</foreignObject>
|
||||
</g>
|
||||
`;
|
||||
expect(postprocessMermaidSvg(before)).toBe(after);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue