mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 17:56:43 +02:00
#6186 Fix for flowchart new syntax with link
This commit is contained in:
@@ -1103,5 +1103,14 @@ end
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should be possible to use @ syntax to add labels with trail spaces and edge/link', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`flowchart TD
|
||||||
|
A["A"] --> B["for B"] & C@{ label: "for c"} & E@{label : "for E"}
|
||||||
|
D@{label: "for D"}
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -302,6 +302,21 @@ describe('when parsing directions', function () {
|
|||||||
expect(data4Layout.nodes[1].label).toEqual('labe for n4');
|
expect(data4Layout.nodes[1].label).toEqual('labe for n4');
|
||||||
expect(data4Layout.nodes[2].label).toEqual('labe for n5');
|
expect(data4Layout.nodes[2].label).toEqual('labe for n5');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be possible to use @ syntax to add labels on multi nodes with edge/link', function () {
|
||||||
|
const res = flow.parser.parse(`flowchart TD
|
||||||
|
A["A"] --> B["for B"] & C@{ label: "for c"} & E@{label : "for E"}
|
||||||
|
D@{label: "for D"}
|
||||||
|
`);
|
||||||
|
|
||||||
|
const data4Layout = flow.parser.yy.getData();
|
||||||
|
expect(data4Layout.nodes.length).toBe(5);
|
||||||
|
expect(data4Layout.nodes[0].label).toEqual('A');
|
||||||
|
expect(data4Layout.nodes[1].label).toEqual('for B');
|
||||||
|
expect(data4Layout.nodes[2].label).toEqual('for c');
|
||||||
|
expect(data4Layout.nodes[3].label).toEqual('for E');
|
||||||
|
expect(data4Layout.nodes[4].label).toEqual('for D');
|
||||||
|
});
|
||||||
it.skip(' should be possible to use @ syntax to add labels with trail spaces', function () {
|
it.skip(' should be possible to use @ syntax to add labels with trail spaces', function () {
|
||||||
const res = flow.parser.parse(
|
const res = flow.parser.parse(
|
||||||
`flowchart TB
|
`flowchart TB
|
||||||
|
@@ -399,7 +399,7 @@ shapeData:
|
|||||||
;
|
;
|
||||||
|
|
||||||
vertexStatement: vertexStatement link node shapeData
|
vertexStatement: vertexStatement link node shapeData
|
||||||
{ /* console.warn('vs shapeData',$vertexStatement.stmt,$node, $shapeData);*/ yy.addVertex($node[0],undefined,undefined,undefined, undefined,undefined, undefined,$shapeData); yy.addLink($vertexStatement.stmt,$node,$link); $$ = { stmt: $node, nodes: $node.concat($vertexStatement.nodes) } }
|
{ /* console.warn('vs shapeData',$vertexStatement.stmt,$node, $shapeData);*/ yy.addVertex($node[$node.length-1],undefined,undefined,undefined, undefined,undefined, undefined,$shapeData); yy.addLink($vertexStatement.stmt,$node,$link); $$ = { stmt: $node, nodes: $node.concat($vertexStatement.nodes) } }
|
||||||
| vertexStatement link node
|
| vertexStatement link node
|
||||||
{ /*console.warn('vs',$vertexStatement.stmt,$node);*/ yy.addLink($vertexStatement.stmt,$node,$link); $$ = { stmt: $node, nodes: $node.concat($vertexStatement.nodes) } }
|
{ /*console.warn('vs',$vertexStatement.stmt,$node);*/ yy.addLink($vertexStatement.stmt,$node,$link); $$ = { stmt: $node, nodes: $node.concat($vertexStatement.nodes) } }
|
||||||
| vertexStatement link node spaceList
|
| vertexStatement link node spaceList
|
||||||
|
Reference in New Issue
Block a user