mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-05 21:34:14 +01:00
Fix exceptions for empty lines
This commit is contained in:
@@ -88,6 +88,16 @@ context('Sequence diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should handle empty lines', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sequenceDiagram
|
||||||
|
Alice->>John: Hello John<br/>
|
||||||
|
John-->>Alice: Great!
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
it('should handle line breaks and wrap annotations', () => {
|
it('should handle line breaks and wrap annotations', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -764,6 +764,9 @@ export const calculateTextDimensions: (
|
|||||||
let cheight = 0;
|
let cheight = 0;
|
||||||
const dim = { width: 0, height: 0, lineHeight: 0 };
|
const dim = { width: 0, height: 0, lineHeight: 0 };
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
|
if (!line) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const textObj = getTextObj();
|
const textObj = getTextObj();
|
||||||
textObj.text = line;
|
textObj.text = line;
|
||||||
const textElem = drawSimpleText(g, textObj)
|
const textElem = drawSimpleText(g, textObj)
|
||||||
|
|||||||
Reference in New Issue
Block a user