mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 15:59:51 +02:00
#834 Using & as a separator for the multiple nodes
This commit is contained in:
@@ -37,7 +37,7 @@ describe('when parsing flowcharts', function() {
|
||||
it('should handle chaining of vertices', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A B --> C;
|
||||
A & B --> C;
|
||||
`);
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
@@ -59,7 +59,7 @@ describe('when parsing flowcharts', function() {
|
||||
it('should multiple vertices in link statement in the begining', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A-->B C;
|
||||
A-->B & C;
|
||||
`);
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
@@ -81,7 +81,7 @@ describe('when parsing flowcharts', function() {
|
||||
it('should multiple vertices in link statement at the end', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A B--> C D;
|
||||
A & B--> C & D;
|
||||
`);
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
@@ -112,7 +112,7 @@ describe('when parsing flowcharts', function() {
|
||||
it('should handle chaining of vertices at both ends at once', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A B--> C D;
|
||||
A & B--> C & D;
|
||||
`);
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
@@ -140,10 +140,10 @@ describe('when parsing flowcharts', function() {
|
||||
expect(edges[3].type).toBe('arrow');
|
||||
expect(edges[3].text).toBe('');
|
||||
});
|
||||
it('should handle chaining and multiple nodes in in link statement', function() {
|
||||
it('should handle chaining and multiple nodes in in link statement FVC ', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A --> B C --> D;
|
||||
A --> B & B2 & C --> D2;
|
||||
`);
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
@@ -151,30 +151,39 @@ describe('when parsing flowcharts', function() {
|
||||
|
||||
expect(vert['A'].id).toBe('A');
|
||||
expect(vert['B'].id).toBe('B');
|
||||
expect(vert['B2'].id).toBe('B2');
|
||||
expect(vert['C'].id).toBe('C');
|
||||
expect(vert['D'].id).toBe('D');
|
||||
expect(edges.length).toBe(4);
|
||||
expect(vert['D2'].id).toBe('D2');
|
||||
expect(edges.length).toBe(6);
|
||||
expect(edges[0].start).toBe('A');
|
||||
expect(edges[0].end).toBe('B');
|
||||
expect(edges[0].type).toBe('arrow');
|
||||
expect(edges[0].text).toBe('');
|
||||
expect(edges[1].start).toBe('A');
|
||||
expect(edges[1].end).toBe('C');
|
||||
expect(edges[1].end).toBe('B2');
|
||||
expect(edges[1].type).toBe('arrow');
|
||||
expect(edges[1].text).toBe('');
|
||||
expect(edges[2].start).toBe('B');
|
||||
expect(edges[2].end).toBe('D');
|
||||
expect(edges[2].start).toBe('A');
|
||||
expect(edges[2].end).toBe('C');
|
||||
expect(edges[2].type).toBe('arrow');
|
||||
expect(edges[2].text).toBe('');
|
||||
expect(edges[3].start).toBe('C');
|
||||
expect(edges[3].end).toBe('D');
|
||||
expect(edges[3].start).toBe('B');
|
||||
expect(edges[3].end).toBe('D2');
|
||||
expect(edges[3].type).toBe('arrow');
|
||||
expect(edges[3].text).toBe('');
|
||||
expect(edges[4].start).toBe('B2');
|
||||
expect(edges[4].end).toBe('D2');
|
||||
expect(edges[4].type).toBe('arrow');
|
||||
expect(edges[4].text).toBe('');
|
||||
expect(edges[5].start).toBe('C');
|
||||
expect(edges[5].end).toBe('D2');
|
||||
expect(edges[5].type).toBe('arrow');
|
||||
expect(edges[5].text).toBe('');
|
||||
});
|
||||
it('should handle chaining and multiple nodes in in link statement with extra info in statements', function() {
|
||||
const res = flow.parser.parse(`
|
||||
graph TD
|
||||
A[ h ] -- hello --> B[" test "]:::exClass C --> D;
|
||||
A[ h ] -- hello --> B[" test "]:::exClass & C --> D;
|
||||
classDef exClass background:#bbb,border:1px solid red;
|
||||
`);
|
||||
|
||||
|
Reference in New Issue
Block a user