@@ -251,7 +251,7 @@ describe('when parsing directions', function () {
251
251
expect ( data4Layout . nodes [ 0 ] . shape ) . toEqual ( 'squareRect' ) ;
252
252
expect ( data4Layout . nodes [ 0 ] . label ) . toEqual ( 'This is a<br/>multiline string' ) ;
253
253
} ) ;
254
- it ( ' should be possible to use } in strings' , function ( ) {
254
+ it ( 'should be possible to use } in strings' , function ( ) {
255
255
const res = flow . parser . parse ( `flowchart TB
256
256
A@{
257
257
label: "This is a string with }"
@@ -264,7 +264,7 @@ describe('when parsing directions', function () {
264
264
expect ( data4Layout . nodes [ 0 ] . shape ) . toEqual ( 'squareRect' ) ;
265
265
expect ( data4Layout . nodes [ 0 ] . label ) . toEqual ( 'This is a string with }' ) ;
266
266
} ) ;
267
- it ( ' should be possible to use @ in strings' , function ( ) {
267
+ it ( 'should be possible to use @ in strings' , function ( ) {
268
268
const res = flow . parser . parse ( `flowchart TB
269
269
A@{
270
270
label: "This is a string with @"
@@ -277,7 +277,7 @@ describe('when parsing directions', function () {
277
277
expect ( data4Layout . nodes [ 0 ] . shape ) . toEqual ( 'squareRect' ) ;
278
278
expect ( data4Layout . nodes [ 0 ] . label ) . toEqual ( 'This is a string with @' ) ;
279
279
} ) ;
280
- it ( ' should be possible to use @ in strings' , function ( ) {
280
+ it ( 'should be possible to use @ in strings' , function ( ) {
281
281
const res = flow . parser . parse ( `flowchart TB
282
282
A@{
283
283
label: "This is a string with}"
@@ -291,7 +291,7 @@ describe('when parsing directions', function () {
291
291
expect ( data4Layout . nodes [ 0 ] . label ) . toEqual ( 'This is a string with}' ) ;
292
292
} ) ;
293
293
294
- it ( ' should be possible to use @ syntax to add labels on multi nodes' , function ( ) {
294
+ it ( 'should be possible to use @ syntax to add labels on multi nodes' , function ( ) {
295
295
const res = flow . parser . parse ( `flowchart TB
296
296
n2["label for n2"] & n4@{ label: "labe for n4"} & n5@{ label: "labe for n5"}
297
297
` ) ;
@@ -343,7 +343,64 @@ describe('when parsing directions', function () {
343
343
expect ( data4Layout . nodes [ 9 ] . label ) . toEqual ( '@for@ AS@' ) ;
344
344
expect ( data4Layout . nodes [ 10 ] . label ) . toEqual ( '@for@ AS@' ) ;
345
345
} ) ;
346
- it . skip ( ' should be possible to use @ syntax to add labels with trail spaces' , function ( ) {
346
+
347
+ it ( 'should handle unique edge creation with using @ and &' , function ( ) {
348
+ const res = flow . parser . parse ( `flowchart TD
349
+ A & B e1@--> C & D
350
+ A1 e2@--> C1 & D1
351
+ ` ) ;
352
+
353
+ const data4Layout = flow . parser . yy . getData ( ) ;
354
+ expect ( data4Layout . nodes . length ) . toBe ( 7 ) ;
355
+ expect ( data4Layout . edges . length ) . toBe ( 6 ) ;
356
+ expect ( data4Layout . edges [ 0 ] . id ) . toEqual ( 'L_A_C_0' ) ;
357
+ expect ( data4Layout . edges [ 1 ] . id ) . toEqual ( 'L_A_D_0' ) ;
358
+ expect ( data4Layout . edges [ 2 ] . id ) . toEqual ( 'e1' ) ;
359
+ expect ( data4Layout . edges [ 3 ] . id ) . toEqual ( 'L_B_D_0' ) ;
360
+ expect ( data4Layout . edges [ 4 ] . id ) . toEqual ( 'e2' ) ;
361
+ expect ( data4Layout . edges [ 5 ] . id ) . toEqual ( 'L_A1_D1_0' ) ;
362
+ } ) ;
363
+
364
+ it ( 'should handle redefine same edge ids again' , function ( ) {
365
+ const res = flow . parser . parse ( `flowchart TD
366
+ A & B e1@--> C & D
367
+ A1 e1@--> C1 & D1
368
+ ` ) ;
369
+
370
+ const data4Layout = flow . parser . yy . getData ( ) ;
371
+ expect ( data4Layout . nodes . length ) . toBe ( 7 ) ;
372
+ expect ( data4Layout . edges . length ) . toBe ( 6 ) ;
373
+ expect ( data4Layout . edges [ 0 ] . id ) . toEqual ( 'L_A_C_0' ) ;
374
+ expect ( data4Layout . edges [ 1 ] . id ) . toEqual ( 'L_A_D_0' ) ;
375
+ expect ( data4Layout . edges [ 2 ] . id ) . toEqual ( 'e1' ) ;
376
+ expect ( data4Layout . edges [ 3 ] . id ) . toEqual ( 'L_B_D_0' ) ;
377
+ expect ( data4Layout . edges [ 4 ] . id ) . toEqual ( 'L_A1_C1_0' ) ;
378
+ expect ( data4Layout . edges [ 5 ] . id ) . toEqual ( 'L_A1_D1_0' ) ;
379
+ } ) ;
380
+
381
+ it ( 'should handle overriding edge animate again' , function ( ) {
382
+ const res = flow . parser . parse ( `flowchart TD
383
+ A e1@--> B
384
+ C e2@--> D
385
+ E e3@--> F
386
+ e1@{ animate: true }
387
+ e2@{ animate: false }
388
+ e3@{ animate: true }
389
+ e3@{ animate: false }
390
+ ` ) ;
391
+
392
+ const data4Layout = flow . parser . yy . getData ( ) ;
393
+ expect ( data4Layout . nodes . length ) . toBe ( 6 ) ;
394
+ expect ( data4Layout . edges . length ) . toBe ( 3 ) ;
395
+ expect ( data4Layout . edges [ 0 ] . id ) . toEqual ( 'e1' ) ;
396
+ expect ( data4Layout . edges [ 0 ] . animate ) . toEqual ( true ) ;
397
+ expect ( data4Layout . edges [ 1 ] . id ) . toEqual ( 'e2' ) ;
398
+ expect ( data4Layout . edges [ 1 ] . animate ) . toEqual ( false ) ;
399
+ expect ( data4Layout . edges [ 2 ] . id ) . toEqual ( 'e3' ) ;
400
+ expect ( data4Layout . edges [ 2 ] . animate ) . toEqual ( false ) ;
401
+ } ) ;
402
+
403
+ it . skip ( 'should be possible to use @ syntax to add labels with trail spaces' , function ( ) {
347
404
const res = flow . parser . parse (
348
405
`flowchart TB
349
406
n2["label for n2"] & n4@{ label: "labe for n4"} & n5@{ label: "labe for n5"} `
0 commit comments