Merge branch 'develop' into feature/3250/add_vertline_to_gantt_plot

This commit is contained in:
Megan Triplett
2025-04-28 16:22:07 -04:00
committed by GitHub
3 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'mermaid': major
---
fix: allow sequence diagram arrows with a trailing colon but no message

View File

@@ -84,7 +84,8 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
\-\-[x] return 'DOTTED_CROSS';
\-[\)] return 'SOLID_POINT';
\-\-[\)] return 'DOTTED_POINT';
":"(?:(?:no)?wrap:)?[^#\n;]+ return 'TXT';
":"(?:(?:no)?wrap:)?[^#\n;]* return 'TXT';
":" return 'TXT';
"+" return '+';
"-" return '-';
<<EOF>> return 'NEWLINE';

View File

@@ -2022,4 +2022,20 @@ describe('sequence db class', () => {
expect(Object.hasOwn(sequenceDb, fun)).toBe(true);
}
});
// This test verifies that messages with a colon but no content (e.g., "Alice->>Bob:")
// are correctly parsed as valid messages with an empty string as the message content.
it('should parse a message with a trailing colon but no content', async () => {
const diagram = await Diagram.fromText(`
sequenceDiagram
Alice->>Bob:
Bob->>Alice:Got it!
`);
const messages = diagram.db.getMessages();
expect(messages.length).toBe(2);
expect(messages[0].message).toBe('');
expect(messages[0].from).toBe('Alice');
expect(messages[0].to).toBe('Bob');
});
});