Added DIR element as valid text token, fix for issue #8
This commit is contained in:
parent
ab78295faf
commit
7b09a6d1bf
|
@ -264,7 +264,10 @@ textToken: ALPHA
|
|||
{$$ = $1;}
|
||||
| MINUS
|
||||
{$$ = $1;}
|
||||
| DIR
|
||||
{$$ = $1;}
|
||||
;
|
||||
|
||||
textNoTags: textNoTagsToken
|
||||
{$$=$1;}
|
||||
| textNoTags textNoTagsToken
|
||||
|
@ -293,6 +296,8 @@ textNoTagsToken: ALPHA
|
|||
{$$ = $1;}
|
||||
| MINUS
|
||||
{$$ = $1;}
|
||||
| DIR
|
||||
{$$ = $1;}
|
||||
;
|
||||
|
||||
classDefStatement:CLASSDEF SPACE alphaNum SPACE stylesOpt
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -88,6 +88,17 @@ describe('when parsing ',function(){
|
|||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
});
|
||||
it('should handle text on edges with space dir',function(){
|
||||
var res = flow.parser.parse('graph TD;A--x|text including URL space|B;');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(edges[0].text).toBe('text including URL space');
|
||||
|
||||
});
|
||||
it('should handle multi-line text',function(){
|
||||
var res = flow.parser.parse('graph TD;A--o|text space|B;\n B-->|more text with space|C;');
|
||||
|
||||
|
@ -197,6 +208,15 @@ describe('when parsing ',function(){
|
|||
expect(vert['C'].type).toBe('round');
|
||||
expect(vert['C'].text).toBe('some CAPS');
|
||||
});
|
||||
it('should handle text in vertices with directions',function(){
|
||||
var res = flow.parser.parse('graph TD;A-->C(some URL);');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
expect(vert['C'].type).toBe('round');
|
||||
expect(vert['C'].text).toBe('some URL');
|
||||
});
|
||||
it('should handle a single node',function(){
|
||||
// Silly but syntactically correct
|
||||
var res = flow.parser.parse('graph TD;A;');
|
||||
|
|
Loading…
Reference in New Issue