mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-01 06:36:40 +02:00
Merge branch 'develop' into feature/3250/add_vertline_to_gantt_plot
This commit is contained in:
5
.changeset/sixty-deer-tell.md
Normal file
5
.changeset/sixty-deer-tell.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': major
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: allow sequence diagram arrows with a trailing colon but no message
|
@@ -84,7 +84,8 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
|
|||||||
\-\-[x] return 'DOTTED_CROSS';
|
\-\-[x] return 'DOTTED_CROSS';
|
||||||
\-[\)] return 'SOLID_POINT';
|
\-[\)] return 'SOLID_POINT';
|
||||||
\-\-[\)] return 'DOTTED_POINT';
|
\-\-[\)] return 'DOTTED_POINT';
|
||||||
":"(?:(?:no)?wrap:)?[^#\n;]+ return 'TXT';
|
":"(?:(?:no)?wrap:)?[^#\n;]* return 'TXT';
|
||||||
|
":" return 'TXT';
|
||||||
"+" return '+';
|
"+" return '+';
|
||||||
"-" return '-';
|
"-" return '-';
|
||||||
<<EOF>> return 'NEWLINE';
|
<<EOF>> return 'NEWLINE';
|
||||||
|
@@ -2022,4 +2022,20 @@ describe('sequence db class', () => {
|
|||||||
expect(Object.hasOwn(sequenceDb, fun)).toBe(true);
|
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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user