mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-27 20:26:47 +02:00
Initial checkin
This commit is contained in:
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"typescript.format.enable": false,
|
||||
"typescript.reportStyleChecksAsWarnings": false,
|
||||
"typescript.validate.enable": false,
|
||||
"javascript.validate.enable": false,
|
||||
"editor.formatOnSave": false,
|
||||
"editor.snippetSuggestions": "top"
|
||||
}
|
@@ -190,7 +190,7 @@ describe('Flowcart', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('9: should render subgraphs with a title startign with a digit', () => {
|
||||
it('9: should render subgraphs with a title starting with a digit', () => {
|
||||
imgSnapshotTest(
|
||||
`
|
||||
graph TB
|
||||
@@ -237,7 +237,7 @@ describe('Flowcart', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('11: should render a flowchart with ling sames and class definitoins', () => {
|
||||
it('11: should render a flowchart with long names and class definitions', () => {
|
||||
imgSnapshotTest(
|
||||
`graph LR
|
||||
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
||||
|
@@ -297,5 +297,100 @@ describe('class diagram, ', function() {
|
||||
expect(testClass.methods[0]).toBe('test()');
|
||||
expect(testClass.methods[1]).toBe('foo()');
|
||||
});
|
||||
|
||||
it('should handle a comment', function () {
|
||||
const str =
|
||||
'classDiagram\n' +
|
||||
'%% Comment \n' +
|
||||
'class Class1 {\n' +
|
||||
'int : test\n' +
|
||||
'string : foo\n' +
|
||||
'test()\n' +
|
||||
'foo()\n' +
|
||||
'}';
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
|
||||
// it('should handle comments at the start', function () {
|
||||
// const str =
|
||||
// '%% Comment\n' +
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '}';
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('should handle comments at the end', function () {
|
||||
// const str =
|
||||
// 'classDiagram\n' +
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '\n}' +
|
||||
// '%% Comment\n';
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('should handle comments at the end no trailing newline', function () {
|
||||
// const str =
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '}\n' +
|
||||
// '%% Comment';
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('should handle comments at the end many trailing newlines', function () {
|
||||
// const str =
|
||||
// 'classDiagram\n' +
|
||||
// '%% Comment\n\n\n\n\n' +
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '}';
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('should handle a comment with blank rows in-between', function () {
|
||||
// const str =
|
||||
// 'classDiagram\n\n\n' +
|
||||
// '%% Comment\n\n' +
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '}';
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('should handle a comment with mermaid class diagram code in them', function () {
|
||||
// const str =
|
||||
// 'classDiagram\n' +
|
||||
// '%% Comment Class01 <|-- Class02\n' +
|
||||
// 'class Class1 {\n' +
|
||||
// 'int : test\n' +
|
||||
// 'string : foo\n' +
|
||||
// 'test()\n' +
|
||||
// 'foo()\n' +
|
||||
// '}';
|
||||
|
||||
// parser.parse(str);
|
||||
//});
|
||||
});
|
||||
});
|
||||
|
@@ -27,7 +27,7 @@ describe('[Comments] when parsing', () => {
|
||||
expect(edges[0].text).toBe('');
|
||||
});
|
||||
|
||||
it('should handle comments a at the start', function() {
|
||||
it('should handle comments at the start', function() {
|
||||
const res = flow.parser.parse('%% Comment\ngraph TD;\n A-->B;');
|
||||
|
||||
const vert = flow.parser.yy.getVertices();
|
||||
|
@@ -460,13 +460,6 @@ text: textToken
|
||||
|
||||
|
||||
|
||||
commentText: commentToken
|
||||
{$$=$1;}
|
||||
| commentText commentToken
|
||||
{$$=$1+''+$2;}
|
||||
;
|
||||
|
||||
|
||||
keywords
|
||||
: STYLE | LINKSTYLE | CLASSDEF | CLASS | CLICK | GRAPH | DIR | subgraph | end | DOWN | UP;
|
||||
|
||||
@@ -516,8 +509,6 @@ linkStyleStatement
|
||||
{$$ = $1;yy.updateLinkInterpolate($3,$7);}
|
||||
;
|
||||
|
||||
commentStatement: PCT PCT commentText;
|
||||
|
||||
numList: NUM
|
||||
{$$ = [$1]}
|
||||
| numList COMMA NUM
|
||||
@@ -539,8 +530,6 @@ styleComponent: ALPHA | COLON | MINUS | NUM | UNIT | SPACE | HEX | BRKT | DOT |
|
||||
|
||||
/* Token lists */
|
||||
|
||||
commentToken : textToken | graphCodeTokens ;
|
||||
|
||||
textToken : textNoTagsToken | TAGSTART | TAGEND | '==' | '--' | PCT | DEFAULT;
|
||||
|
||||
textNoTagsToken: alphaNumToken | SPACE | MINUS | keywords ;
|
||||
|
Reference in New Issue
Block a user