@@ -6,13 +6,13 @@ setConfig({
6
6
securityLevel : 'strict' ,
7
7
} ) ;
8
8
9
- describe ( 'when parsing ' , function ( ) {
9
+ describe ( 'parsing a flow chart ' , function ( ) {
10
10
beforeEach ( function ( ) {
11
11
flow . parser . yy = flowDb ;
12
12
flow . parser . yy . clear ( ) ;
13
13
} ) ;
14
14
15
- it ( 'it should handle a trailing whitespaces after statememnts' , function ( ) {
15
+ it ( 'should handle a trailing whitespaces after statememnts' , function ( ) {
16
16
const res = flow . parser . parse ( 'graph TD;\n\n\n %% Comment\n A-->B; \n B-->C;' ) ;
17
17
18
18
const vert = flow . parser . yy . getVertices ( ) ;
@@ -80,47 +80,47 @@ describe('when parsing ', function () {
80
80
flow . parser . yy . clear ( ) ;
81
81
} ;
82
82
83
- it ( "it should be able to parse a '.'" , function ( ) {
83
+ it ( "should be able to parse a '.'" , function ( ) {
84
84
charTest ( '.' ) ;
85
85
charTest ( 'Start 103a.a1' ) ;
86
86
} ) ;
87
87
88
- // it('it should be able to parse text containing \'_\'', function () {
88
+ // it('should be able to parse text containing \'_\'', function () {
89
89
// charTest('_')
90
90
// })
91
91
92
- it ( "it should be able to parse a ':'" , function ( ) {
92
+ it ( "should be able to parse a ':'" , function ( ) {
93
93
charTest ( ':' ) ;
94
94
} ) ;
95
95
96
- it ( "it should be able to parse a ','" , function ( ) {
96
+ it ( "should be able to parse a ','" , function ( ) {
97
97
charTest ( ',' ) ;
98
98
} ) ;
99
99
100
- it ( "it should be able to parse text containing '-'" , function ( ) {
100
+ it ( "should be able to parse text containing '-'" , function ( ) {
101
101
charTest ( 'a-b' ) ;
102
102
} ) ;
103
103
104
- it ( "it should be able to parse a '+'" , function ( ) {
104
+ it ( "should be able to parse a '+'" , function ( ) {
105
105
charTest ( '+' ) ;
106
106
} ) ;
107
107
108
- it ( "it should be able to parse a '*'" , function ( ) {
108
+ it ( "should be able to parse a '*'" , function ( ) {
109
109
charTest ( '*' ) ;
110
110
} ) ;
111
111
112
- it ( "it should be able to parse a '<'" , function ( ) {
112
+ it ( "should be able to parse a '<'" , function ( ) {
113
113
charTest ( '<' , '<' ) ;
114
114
} ) ;
115
115
116
- // it("it should be able to parse a '>'", function() {
116
+ // it("should be able to parse a '>'", function() {
117
117
// charTest('>', '>');
118
118
// });
119
119
120
- // it("it should be able to parse a '='", function() {
120
+ // it("should be able to parse a '='", function() {
121
121
// charTest('=', '=');
122
122
// });
123
- it ( "it should be able to parse a '&'" , function ( ) {
123
+ it ( "should be able to parse a '&'" , function ( ) {
124
124
charTest ( '&' ) ;
125
125
} ) ;
126
126
} ) ;
@@ -146,6 +146,7 @@ describe('when parsing ', function () {
146
146
const classes = flow . parser . yy . getClasses ( ) ;
147
147
expect ( vertices [ 'A' ] . id ) . toBe ( 'A' ) ;
148
148
} ) ;
149
+
149
150
it ( 'should be possible to use numbers as labels' , function ( ) {
150
151
let statement = '' ;
151
152
@@ -155,4 +156,19 @@ describe('when parsing ', function () {
155
156
const classes = flow . parser . yy . getClasses ( ) ;
156
157
expect ( vertices [ '1' ] . id ) . toBe ( '1' ) ;
157
158
} ) ;
159
+
160
+ it ( 'should add title and description to flow chart' , function ( ) {
161
+ const flowChart = `graph LR
162
+ title Big decisions
163
+ accDescription Flow chart of the decision making process
164
+ A[Hard] -->|Text| B(Round)
165
+ B --> C{Decision}
166
+ C -->|One| D[Result 1]
167
+ C -->|Two| E[Result 2]
168
+ ` ;
169
+
170
+ flow . parser . parse ( flowChart ) ;
171
+ expect ( flow . parser . yy . getTitle ( ) ) . toBe ( 'Big decisions' ) ;
172
+ expect ( flow . parser . yy . getAccDescription ( ) ) . toBe ( 'Flow chart of the decision making process' ) ;
173
+ } ) ;
158
174
} ) ;
0 commit comments