Merge pull request #4553 from tomperr/fix/4550-chaining-style
fix(flowchart): allow multiple vertices with style
This commit is contained in:
commit
c042c4a5ef
|
@ -338,4 +338,20 @@ describe('[Style] when parsing', () => {
|
||||||
|
|
||||||
expect(edges[0].type).toBe('arrow_point');
|
expect(edges[0].type).toBe('arrow_point');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should handle multiple vertices with style', function () {
|
||||||
|
const res = flow.parser.parse(`
|
||||||
|
graph TD
|
||||||
|
classDef C1 stroke-dasharray:4
|
||||||
|
classDef C2 stroke-dasharray:6
|
||||||
|
A & B:::C1 & D:::C1 --> E:::C2
|
||||||
|
`);
|
||||||
|
|
||||||
|
const vert = flow.parser.yy.getVertices();
|
||||||
|
|
||||||
|
expect(vert['A'].classes.length).toBe(0);
|
||||||
|
expect(vert['B'].classes[0]).toBe('C1');
|
||||||
|
expect(vert['D'].classes[0]).toBe('C1');
|
||||||
|
expect(vert['E'].classes[0]).toBe('C2');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -368,12 +368,16 @@ verticeStatement: verticeStatement link node
|
||||||
|node { /*console.warn('noda', $1);*/ $$ = {stmt: $1, nodes:$1 }}
|
|node { /*console.warn('noda', $1);*/ $$ = {stmt: $1, nodes:$1 }}
|
||||||
;
|
;
|
||||||
|
|
||||||
node: vertex
|
node: styledVertex
|
||||||
{ /* console.warn('nod', $1); */ $$ = [$1];}
|
{ /* console.warn('nod', $1); */ $$ = [$1];}
|
||||||
| node spaceList AMP spaceList vertex
|
| node spaceList AMP spaceList styledVertex
|
||||||
{ $$ = $1.concat($5); /* console.warn('pip', $1[0], $5, $$); */ }
|
{ $$ = $1.concat($5); /* console.warn('pip', $1[0], $5, $$); */ }
|
||||||
|
;
|
||||||
|
|
||||||
|
styledVertex: vertex
|
||||||
|
{ /* console.warn('nod', $1); */ $$ = $1;}
|
||||||
| vertex STYLE_SEPARATOR idString
|
| vertex STYLE_SEPARATOR idString
|
||||||
{$$ = [$1];yy.setClass($1,$3)}
|
{$$ = $1;yy.setClass($1,$3)}
|
||||||
;
|
;
|
||||||
|
|
||||||
vertex: idString SQS text SQE
|
vertex: idString SQS text SQE
|
||||||
|
|
Loading…
Reference in New Issue