Support dashes in actor names in sequence diagrams
This commit is contained in:
parent
dbda90b15b
commit
b120c34177
|
@ -58,10 +58,10 @@
|
|||
"deactivate" { this.begin('ID'); return 'deactivate'; }
|
||||
"title" return 'title';
|
||||
"sequenceDiagram" return 'SD';
|
||||
"autonumber" return 'autonumber';
|
||||
"autonumber" return 'autonumber';
|
||||
"," return ',';
|
||||
";" return 'NL';
|
||||
[^\+\->:\n,;]+ { yytext = yytext.trim(); return 'ACTOR'; }
|
||||
[^\+\->:\n,;]+((?!(\-x|\-\-x))[\-]*[^\+\->:\n,;]+)* { yytext = yytext.trim(); return 'ACTOR'; }
|
||||
"->>" return 'SOLID_ARROW';
|
||||
"-->>" return 'DOTTED_ARROW';
|
||||
"->" return 'SOLID_OPEN_ARROW';
|
||||
|
|
|
@ -93,6 +93,23 @@ Bob-->Alice: I am good thanks!`;
|
|||
expect(messages[0].from).toBe('Alice');
|
||||
expect(messages[1].from).toBe('Bob');
|
||||
});
|
||||
it('it should handle dashes in actor names', function() {
|
||||
const str = `
|
||||
sequenceDiagram
|
||||
Alice-in-Wonderland->Bob:Hello Bob, how are - you?
|
||||
Bob-->Alice-in-Wonderland:I am good thanks!`;
|
||||
|
||||
mermaidAPI.parse(str);
|
||||
const actors = parser.yy.getActors();
|
||||
expect(actors["Alice-in-Wonderland"].description).toBe('Alice-in-Wonderland');
|
||||
actors.Bob.description = 'Bob';
|
||||
|
||||
const messages = parser.yy.getMessages();
|
||||
|
||||
expect(messages.length).toBe(2);
|
||||
expect(messages[0].from).toBe('Alice-in-Wonderland');
|
||||
expect(messages[1].from).toBe('Bob');
|
||||
});
|
||||
it('it should alias participants', function() {
|
||||
const str = `
|
||||
sequenceDiagram
|
||||
|
|
Loading…
Reference in New Issue