Making it possible to have style/% in class definitions as described in issue #54

This commit is contained in:
knsv
2015-01-08 08:20:07 +01:00
parent 5a720b6d63
commit 952723706b
8 changed files with 37 additions and 17 deletions

View File

@@ -341,7 +341,7 @@ style: styleComponent
{$$ = $1 + $2;}
;
styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT;
styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT | STYLE | PCT ;
/* Token lists */

File diff suppressed because one or more lines are too long

View File

@@ -288,6 +288,26 @@ describe('when parsing ',function(){
expect(edges[0].type).toBe('arrow');
});
it('should handle classDefs with style in classes',function(){
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass font-style:bold;');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges[0].type).toBe('arrow');
});
it('should handle classDefs with % in classes',function(){
var res = flow.parser.parse('graph TD\nA-->B\nclassDef exClass fill:#f96,stroke:#333,stroke-width:4px,font-size:50%,font-style:bold;');
var vert = flow.parser.yy.getVertices();
var edges = flow.parser.yy.getEdges();
expect(edges[0].type).toBe('arrow');
});
describe("it should handle text on edges",function(){
it('it should handle text without space',function(){
var res = flow.parser.parse('graph TD;A--x|textNoSpace|B;');