Flow grammer is modified to allow each line ending without semicolon to improve readablity. The old declarations also work. One test is also included in flow.spec.js to test the changes.

This commit is contained in:
vijay40
2014-12-15 15:32:47 +05:30
parent 13a65db40e
commit 3279edab33
3 changed files with 84 additions and 43 deletions

View File

@@ -46,6 +46,22 @@ describe('when parsing ',function(){
expect(edges[0].text).toBe('');
});
it('should handle a nodes and edges, a space between link and node and each line ending without semicolon',function(){
var res = flow.parser.parse('graph TD\nA --> B\n style e red');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(vert['A'].id).toBe('A');
expect(vert['B'].id).toBe('B');
expect(edges.length).toBe(1);
expect(edges[0].start).toBe('A');
expect(edges[0].end).toBe('B');
expect(edges[0].type).toBe('arrow');
expect(edges[0].text).toBe('');
});
it('should handle a comments',function(){
var res = flow.parser.parse('graph TD;\n%% CComment\n A-->B;');