mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
feat(flowchart): Allow default in the node ID
This commit is contained in:
parent
17a23a1103
commit
a3b2ba736d
@ -643,4 +643,15 @@ flowchart RL
|
|||||||
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'}
|
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('2388: handling default in the node name', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
flowchart LR
|
||||||
|
default-index.js --> dot.template.js
|
||||||
|
index.js --> module-utl.js
|
||||||
|
`,
|
||||||
|
{htmlLabels: true, flowchart: {htmlLabels: true}, securityLevel: 'loose'}
|
||||||
|
)
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
8
dist/mermaid.core.js
vendored
8
dist/mermaid.core.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.core.js.map
vendored
2
dist/mermaid.core.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.esm.min.mjs
vendored
2
dist/mermaid.esm.min.mjs
vendored
File diff suppressed because one or more lines are too long
8
dist/mermaid.js
vendored
8
dist/mermaid.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.js.map
vendored
2
dist/mermaid.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.min.js
vendored
2
dist/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.min.js.map
vendored
2
dist/mermaid.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -557,7 +557,7 @@ direction
|
|||||||
|
|
||||||
alphaNumToken : PUNCTUATION | AMP | UNICODE_TEXT | NUM| ALPHA | COLON | COMMA | PLUS | EQUALS | MULT | DOT | BRKT| UNDERSCORE ;
|
alphaNumToken : PUNCTUATION | AMP | UNICODE_TEXT | NUM| ALPHA | COLON | COMMA | PLUS | EQUALS | MULT | DOT | BRKT| UNDERSCORE ;
|
||||||
|
|
||||||
idStringToken : ALPHA|UNDERSCORE |UNICODE_TEXT | NUM| COLON | COMMA | PLUS | MINUS | DOWN |EQUALS | MULT | BRKT | DOT | PUNCTUATION | AMP;
|
idStringToken : ALPHA|UNDERSCORE |UNICODE_TEXT | NUM| COLON | COMMA | PLUS | MINUS | DOWN |EQUALS | MULT | BRKT | DOT | PUNCTUATION | AMP | DEFAULT;
|
||||||
|
|
||||||
graphCodeTokens: STADIUMSTART | STADIUMEND | SUBROUTINESTART | SUBROUTINEEND | CYLINDERSTART | CYLINDEREND | TRAPSTART | TRAPEND | INVTRAPSTART | INVTRAPEND | PIPE | PS | PE | SQS | SQE | DIAMOND_START | DIAMOND_STOP | TAGSTART | TAGEND | ARROW_CROSS | ARROW_POINT | ARROW_CIRCLE | ARROW_OPEN | QUOTE | SEMI;
|
graphCodeTokens: STADIUMSTART | STADIUMEND | SUBROUTINESTART | SUBROUTINEEND | CYLINDERSTART | CYLINDEREND | TRAPSTART | TRAPEND | INVTRAPSTART | INVTRAPEND | PIPE | PS | PE | SQS | SQE | DIAMOND_START | DIAMOND_STOP | TAGSTART | TAGEND | ARROW_CROSS | ARROW_POINT | ARROW_CIRCLE | ARROW_OPEN | QUOTE | SEMI;
|
||||||
%%
|
%%
|
||||||
|
@ -51,6 +51,18 @@ describe('when parsing ', function() {
|
|||||||
expect(edges[0].end).toBe('monograph');
|
expect(edges[0].end).toBe('monograph');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow default in the node name/id', function() {
|
||||||
|
const res = flow.parser.parse('graph TD\ndefault --> monograph');
|
||||||
|
|
||||||
|
const vert = flow.parser.yy.getVertices();
|
||||||
|
const edges = flow.parser.yy.getEdges();
|
||||||
|
|
||||||
|
expect(vert['default'].id).toBe('default');
|
||||||
|
expect(vert['monograph'].id).toBe('monograph');
|
||||||
|
expect(edges[0].start).toBe('default');
|
||||||
|
expect(edges[0].end).toBe('monograph');
|
||||||
|
});
|
||||||
|
|
||||||
describe('special characters should be be handled.', function() {
|
describe('special characters should be be handled.', function() {
|
||||||
const charTest = function(char, result) {
|
const charTest = function(char, result) {
|
||||||
const res = flow.parser.parse('graph TD;A(' + char + ')-->B;');
|
const res = flow.parser.parse('graph TD;A(' + char + ')-->B;');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user