Be explicit about testing semicolons

This commit is contained in:
Richard Gibson
2015-11-05 18:30:18 -05:00
parent e0a31feaec
commit 73e1957c62

View File

@@ -173,6 +173,25 @@ describe('when parsing a sequenceDiagram',function() {
expect(messages[2].from).toBe('Bob');
});
it('it should handle semicolons', function () {
str = 'sequenceDiagram;' +
'Alice->Bob: Hello Bob, how are you?;' +
'Note right of Bob: Bob thinks;' +
'Bob-->Alice: I am good thanks!;';
sq.parse(str);
var actors = sq.yy.getActors();
expect(actors.Alice.description).toBe('Alice');
actors.Bob.description = 'Bob';
var messages = sq.yy.getMessages();
expect(messages.length).toBe(3);
expect(messages[0].from).toBe('Alice');
expect(messages[2].from).toBe('Bob');
});
it('it should handle one leading space in lines in a sequenceDiagram', function () {
str = 'sequenceDiagram\n' +
' Alice->Bob: Hello Bob, how are you?\n\n' +
@@ -285,25 +304,6 @@ describe('when parsing a sequenceDiagram',function() {
expect(messages[1].from).toBe('Bob');
});
it('it should handle opt statements a sequenceDiagram', function () {
var str = 'sequenceDiagram;Alice->Bob: Hello Bob, how are you?;opt Perhaps a happy response;Bob-->Alice: I am good thanks!;end;';
sq.parse(str);
var actors = sq.yy.getActors();
//log.debug(actors);
expect(actors.Alice.description).toBe('Alice');
actors.Bob.description = 'Bob';
var messages = sq.yy.getMessages();
//log.debug(messages);
expect(messages.length).toBe(4);
expect(messages[0].from).toBe('Alice');
expect(messages[1].type).toBe(sq.yy.LINETYPE.OPT_START);
expect(messages[2].from).toBe('Bob');
});
it('it should handle alt statements a sequenceDiagram', function () {
@@ -762,4 +762,4 @@ describe('when rendering a sequenceDiagram with actor mirror activated',function
expect(bounds.stopy ).toBe(2*conf.height+2*conf.boxMargin);
});
});
});