collab/mermaid/cypress/integration/rendering/flowchart-v2.spec.jsblame
View source
6dd74de1import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
6dd74de2
6dd74de3describe('Flowchart v2', () => {
6dd74de4 it('1: should render a simple flowchart', () => {
6dd74de5 imgSnapshotTest(
6dd74de6 `flowchart TD
6dd74de7 A[Christmas] -->|Get money| B(Go shopping)
6dd74de8 B --> C{Let me think}
6dd74de9 C -->|One| D[Laptop]
6dd74de10 C -->|Two| E[iPhone]
6dd74de11 C -->|Three| F[fa:fa-car Car]
6dd74de12 `,
6dd74de13 {}
6dd74de14 );
6dd74de15 });
6dd74de16
6dd74de17 it('2: should render a simple flowchart with diagramPadding set to 0', () => {
6dd74de18 imgSnapshotTest(
6dd74de19 `flowchart TD
6dd74de20 A[Christmas] -->|Get money| B(Go shopping)
6dd74de21 B --> C{Let me think}
6dd74de22 %% this is a comment
6dd74de23 C -->|One| D[Laptop]
6dd74de24 C -->|Two| E[iPhone]
6dd74de25 C -->|Three| F[fa:fa-car Car]
6dd74de26 `,
6dd74de27 { flowchart: { diagramPadding: 0 } }
6dd74de28 );
6dd74de29 });
6dd74de30
6dd74de31 it('3: a link with correct arrowhead to a subgraph', () => {
6dd74de32 imgSnapshotTest(
6dd74de33 `flowchart TD
6dd74de34 P1
6dd74de35 P1 -->P1.5
6dd74de36 subgraph P1.5
6dd74de37 P2
6dd74de38 P2.5(( A ))
6dd74de39 P3
6dd74de40 end
6dd74de41 P2 --> P4
6dd74de42 P3 --> P6
6dd74de43 P1.5 --> P5
6dd74de44 `,
6dd74de45 {}
6dd74de46 );
6dd74de47 });
6dd74de48
6dd74de49 it('4: Length of edges', () => {
6dd74de50 imgSnapshotTest(
6dd74de51 `flowchart TD
6dd74de52 L1 --- L2
6dd74de53 L2 --- C
6dd74de54 M1 ---> C
6dd74de55 R1 .-> R2
6dd74de56 R2 <.-> C
6dd74de57 C -->|Label 1| E1
6dd74de58 C <-- Label 2 ---> E2
6dd74de59 C ----> E3
6dd74de60 C <-...-> E4
6dd74de61 C ======> E5
6dd74de62 `,
6dd74de63 {}
6dd74de64 );
6dd74de65 });
6dd74de66 it('5: should render escaped without html labels', () => {
6dd74de67 imgSnapshotTest(
6dd74de68 `flowchart TD
6dd74de69 a["<strong>Haiya</strong>"]---->b
6dd74de70 `,
6dd74de71 { htmlLabels: false, flowchart: { htmlLabels: false } }
6dd74de72 );
6dd74de73 });
6dd74de74 it('6: should render non-escaped with html labels', () => {
6dd74de75 imgSnapshotTest(
6dd74de76 `flowchart TD
6dd74de77 a["<strong>Haiya</strong>"]===>b
6dd74de78 `,
6dd74de79 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de80 );
6dd74de81 });
6dd74de82 it('6a: should render complex HTML in labels with sandbox security', () => {
6dd74de83 imgSnapshotTest(
6dd74de84 `flowchart TD
6dd74de85 A[Christmas] -->|Get money| B(Go shopping)
6dd74de86 B --> C{Let me think}
6dd74de87 C -->|One| D[Laptop]
6dd74de88 C -->|Two| E[iPhone]
6dd74de89 C -->|Three| F[fa:fa-car Car]
6dd74de90 `,
6dd74de91 { securityLevel: 'sandbox', flowchart: { htmlLabels: true } }
6dd74de92 );
6dd74de93 });
6dd74de94 it('7: should render a flowchart when useMaxWidth is true (default)', () => {
6dd74de95 renderGraph(
6dd74de96 `flowchart TD
6dd74de97 A[Christmas] -->|Get money| B(Go shopping)
6dd74de98 B --> C{Let me think}
6dd74de99 C -->|One| D[Laptop]
6dd74de100 C -->|Two| E[iPhone]
6dd74de101 C -->|Three| F[fa:fa-car Car]
6dd74de102 `,
6dd74de103 { flowchart: { useMaxWidth: true } }
6dd74de104 );
6dd74de105 cy.get('svg').should((svg) => {
6dd74de106 expect(svg).to.have.attr('width', '100%');
6dd74de107 // expect(svg).to.have.attr('height');
6dd74de108 // use within because the absolute value can be slightly different depending on the environment ±5%
6dd74de109 // const height = parseFloat(svg.attr('height'));
6dd74de110 // expect(height).to.be.within(446 * 0.95, 446 * 1.05);
6dd74de111 const style = svg.attr('style');
6dd74de112 expect(style).to.match(/^max-width: [\d.]+px;$/);
6dd74de113 const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
6dd74de114 expect(maxWidthValue).to.be.within(440 * 0.95, 440 * 1.05);
6dd74de115 });
6dd74de116 });
6dd74de117 it('8: should render a flowchart when useMaxWidth is false', () => {
6dd74de118 renderGraph(
6dd74de119 `flowchart TD
6dd74de120 A[Christmas] -->|Get money| B(Go shopping)
6dd74de121 B --> C{Let me think}
6dd74de122 C -->|One| D[Laptop]
6dd74de123 C -->|Two| E[iPhone]
6dd74de124 C -->|Three| F[fa:fa-car Car]
6dd74de125 `,
6dd74de126 { flowchart: { useMaxWidth: false } }
6dd74de127 );
6dd74de128 cy.get('svg').should((svg) => {
6dd74de129 // const height = parseFloat(svg.attr('height'));
6dd74de130 const width = parseFloat(svg.attr('width'));
6dd74de131 // use within because the absolute value can be slightly different depending on the environment ±5%
6dd74de132 // expect(height).to.be.within(446 * 0.95, 446 * 1.05);
6dd74de133 expect(width).to.be.within(440 * 0.95, 440 * 1.05);
6dd74de134 expect(svg).to.not.have.attr('style');
6dd74de135 });
6dd74de136 });
6dd74de137
6dd74de138 it('V2 - 16: Render Stadium shape', () => {
6dd74de139 imgSnapshotTest(
6dd74de140 ` flowchart TD
6dd74de141 A([stadium shape test])
6dd74de142 A -->|Get money| B([Go shopping])
6dd74de143 B --> C([Let me think...<br />Do I want something for work,<br />something to spend every free second with,<br />or something to get around?])
6dd74de144 C -->|One| D([Laptop])
6dd74de145 C -->|Two| E([iPhone])
6dd74de146 C -->|Three| F([Car<br/>wroom wroom])
6dd74de147 click A "index.html#link-clicked" "link test"
6dd74de148 click B testClick "click test"
6dd74de149 classDef someclass fill:#f96;
6dd74de150 class A someclass;
6dd74de151 class C someclass;
6dd74de152 `,
6dd74de153 { flowchart: { htmlLabels: false }, fontFamily: 'courier' }
6dd74de154 );
6dd74de155 });
6dd74de156
6dd74de157 it('50: handle nested subgraphs in reverse order', () => {
6dd74de158 imgSnapshotTest(
6dd74de159 `flowchart LR
6dd74de160 a -->b
6dd74de161 subgraph A
6dd74de162 B
6dd74de163 end
6dd74de164 subgraph B
6dd74de165 b
6dd74de166 end
6dd74de167 `,
6dd74de168 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de169 );
6dd74de170 });
6dd74de171
6dd74de172 it('51: handle nested subgraphs in reverse order', () => {
6dd74de173 imgSnapshotTest(
6dd74de174 `flowchart LR
6dd74de175 a -->b
6dd74de176 subgraph A
6dd74de177 B
6dd74de178 end
6dd74de179 subgraph B
6dd74de180 b
6dd74de181 end
6dd74de182 `,
6dd74de183 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de184 );
6dd74de185 });
6dd74de186
6dd74de187 it('52: handle nested subgraphs in several levels.', () => {
6dd74de188 imgSnapshotTest(
6dd74de189 `flowchart TB
6dd74de190 b-->B
6dd74de191 a-->c
6dd74de192 subgraph O
6dd74de193 A
6dd74de194 end
6dd74de195 subgraph B
6dd74de196 c
6dd74de197 end
6dd74de198 subgraph A
6dd74de199 a
6dd74de200 b
6dd74de201 B
6dd74de202 end
6dd74de203 `,
6dd74de204 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de205 );
6dd74de206 });
6dd74de207
6dd74de208 it('53: handle nested subgraphs with edges in and out', () => {
6dd74de209 imgSnapshotTest(
6dd74de210 `flowchart TB
6dd74de211 internet
6dd74de212 nat
6dd74de213 router
6dd74de214 lb1
6dd74de215 lb2
6dd74de216 compute1
6dd74de217 compute2
6dd74de218 subgraph project
6dd74de219 router
6dd74de220 nat
6dd74de221 subgraph subnet1
6dd74de222 compute1
6dd74de223 lb1
6dd74de224 end
6dd74de225 subgraph subnet2
6dd74de226 compute2
6dd74de227 lb2
6dd74de228 end
6dd74de229 end
6dd74de230 internet --> router
6dd74de231 router --> subnet1 & subnet2
6dd74de232 subnet1 & subnet2 --> nat --> internet
6dd74de233 `,
6dd74de234 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de235 );
6dd74de236 });
6dd74de237
6dd74de238 it('54: handle nested subgraphs with outgoing links', () => {
6dd74de239 imgSnapshotTest(
6dd74de240 `flowchart TD
6dd74de241 subgraph main
6dd74de242 subgraph subcontainer
6dd74de243 subcontainer-child
6dd74de244 end
6dd74de245 subcontainer-child--> subcontainer-sibling
6dd74de246 end
6dd74de247 `,
6dd74de248 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de249 );
6dd74de250 });
6dd74de251
6dd74de252 it('55: handle nested subgraphs with outgoing links 2', () => {
6dd74de253 imgSnapshotTest(
6dd74de254 `flowchart TD
6dd74de255
6dd74de256subgraph one[One]
6dd74de257 subgraph sub_one[Sub One]
6dd74de258 _sub_one
6dd74de259 end
6dd74de260 subgraph sub_two[Sub Two]
6dd74de261 _sub_two
6dd74de262 end
6dd74de263 _one
6dd74de264end
6dd74de265
6dd74de266%% here, either the first or the second one
6dd74de267sub_one --> sub_two
6dd74de268_one --> b
6dd74de269 `,
6dd74de270 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de271 );
6dd74de272 });
6dd74de273
6dd74de274 it('56: handle nested subgraphs with outgoing links 3', () => {
6dd74de275 imgSnapshotTest(
6dd74de276 `flowchart TB
6dd74de277 subgraph container_Beta
6dd74de278 process_C-->Process_D
6dd74de279 end
6dd74de280 subgraph container_Alpha
6dd74de281 process_A-->process_B
6dd74de282 process_A-->|messages|process_C
6dd74de283 end
6dd74de284 process_B-->|via_AWSBatch|container_Beta
6dd74de285 `,
6dd74de286 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de287 );
6dd74de288 });
6dd74de289 it('57: handle nested subgraphs with outgoing links 4', () => {
6dd74de290 imgSnapshotTest(
6dd74de291 `flowchart LR
6dd74de292subgraph A
6dd74de293a -->b
6dd74de294end
6dd74de295subgraph B
6dd74de296b
6dd74de297end
6dd74de298 `,
6dd74de299 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de300 );
6dd74de301 });
6dd74de302
6dd74de303 it('57: handle nested subgraphs with outgoing links 2', () => {
6dd74de304 imgSnapshotTest(
6dd74de305 `flowchart TB
6dd74de306 c1-->a2
6dd74de307 subgraph one
6dd74de308 a1-->a2
6dd74de309 end
6dd74de310 subgraph two
6dd74de311 b1-->b2
6dd74de312 end
6dd74de313 subgraph three
6dd74de314 c1-->c2
6dd74de315 end
6dd74de316 one --> two
6dd74de317 three --> two
6dd74de318 two --> c2
6dd74de319 `,
6dd74de320 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de321 );
6dd74de322 });
6dd74de323 it('57.x: handle nested subgraphs with outgoing links 5', () => {
6dd74de324 imgSnapshotTest(
6dd74de325 `%% this does not produce the desired result
6dd74de326flowchart TB
6dd74de327 subgraph container_Beta
6dd74de328 process_C-->Process_D
6dd74de329 end
6dd74de330 subgraph container_Alpha
6dd74de331 process_A-->process_B
6dd74de332 process_B-->|via_AWSBatch|container_Beta
6dd74de333 process_A-->|messages|process_C
6dd74de334 end
6dd74de335 `,
6dd74de336 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de337 );
6dd74de338 });
6dd74de339 it('58: handle styling with style expressions', () => {
6dd74de340 imgSnapshotTest(
6dd74de341 `
6dd74de342 flowchart LR
6dd74de343 id1(Start)-->id2(Stop)
6dd74de344 style id1 fill:#f9f,stroke:#333,stroke-width:4px
6dd74de345 style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
6dd74de346 `,
6dd74de347 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de348 );
6dd74de349 });
6dd74de350 it('59: handle styling of subgraphs and links', () => {
6dd74de351 imgSnapshotTest(
6dd74de352 `
6dd74de353flowchart TD
6dd74de354 A[Christmas] ==> D
6dd74de355 A[Christmas] -->|Get money| B(Go shopping)
6dd74de356 A[Christmas] ==> C
6dd74de357 subgraph T ["Test"]
6dd74de358 A
6dd74de359 B
6dd74de360 C
6dd74de361 end
6dd74de362
6dd74de363 classDef Test fill:#F84E68,stroke:#333,color:white;
6dd74de364 class A,T Test
6dd74de365 classDef TestSub fill:green;
6dd74de366 class T TestSub
6dd74de367 linkStyle 0,1 color:orange, stroke: orange;
6dd74de368 `,
6dd74de369 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de370 );
6dd74de371 });
6dd74de372 it('60: handle styling for all node shapes - v2', () => {
6dd74de373 imgSnapshotTest(
6dd74de374 `
6dd74de375 flowchart LR
6dd74de376 A[red text] -->|default style| B(blue text)
6dd74de377 C([red text]) -->|default style| D[[blue text]]
6dd74de378 E[(red text)] -->|default style| F((blue text))
6dd74de379 G>red text] -->|default style| H{blue text}
6dd74de380 I{{red text}} -->|default style| J[/blue text/]
6dd74de381 K[\\ red text\\] -->|default style| L[/blue text\\]
6dd74de382 M[\\ red text/] -->|default style| N[blue text];
6dd74de383 O(((red text))) -->|default style| P(((blue text)));
6dd74de384 linkStyle default color:Sienna;
6dd74de385 style A stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de386 style B stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de387 style C stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de388 style D stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de389 style E stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de390 style F stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de391 style G stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de392 style H stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de393 style I stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de394 style J stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de395 style K stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de396 style L stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de397 style M stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de398 style N stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de399 style O stroke:#ff0000,fill:#ffcccc,color:#ff0000;
6dd74de400 style P stroke:#0000ff,fill:#ccccff,color:#0000ff;
6dd74de401 `,
6dd74de402 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose', logLevel: 2 }
6dd74de403 );
6dd74de404 });
6dd74de405 it('61: fontawesome icons in edge labels', () => {
6dd74de406 imgSnapshotTest(
6dd74de407 `
6dd74de408 flowchart TD
6dd74de409 C -->|fa:fa-car Car| F[fa:fa-car Car]
6dd74de410 `,
6dd74de411 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de412 );
6dd74de413 });
6dd74de414 it('62: should render styled subgraphs', () => {
6dd74de415 imgSnapshotTest(
6dd74de416 `
6dd74de417 flowchart TB
6dd74de418 A
6dd74de419 B
6dd74de420 subgraph foo[Foo SubGraph]
6dd74de421 C
6dd74de422 D
6dd74de423 end
6dd74de424 subgraph bar[Bar SubGraph]
6dd74de425 E
6dd74de426 F
6dd74de427 end
6dd74de428 G
6dd74de429
6dd74de430 A-->B
6dd74de431 B-->C
6dd74de432 C-->D
6dd74de433 B-->D
6dd74de434 D-->E
6dd74de435 E-->A
6dd74de436 E-->F
6dd74de437 F-->D
6dd74de438 F-->G
6dd74de439 B-->G
6dd74de440 G-->D
6dd74de441
6dd74de442 style foo fill:#F99,stroke-width:2px,stroke:#F0F,color:darkred
6dd74de443 style bar fill:#999,stroke-width:10px,stroke:#0F0,color:blue
6dd74de444 `,
6dd74de445 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de446 );
6dd74de447 });
6dd74de448 it('63: title on subgraphs should be themeable', () => {
6dd74de449 imgSnapshotTest(
6dd74de450 `
6dd74de451 %%{init:{"theme":"base", "themeVariables": {"primaryColor":"#411d4e", "titleColor":"white", "darkMode":true}}}%%
6dd74de452 flowchart LR
6dd74de453 subgraph A
6dd74de454 a --> b
6dd74de455 end
6dd74de456 subgraph B
6dd74de457 i -->f
6dd74de458 end
6dd74de459 A --> B
6dd74de460 `,
6dd74de461 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de462 );
6dd74de463 });
6dd74de464 it('65-1: text-color from classes', () => {
6dd74de465 imgSnapshotTest(
6dd74de466 `
6dd74de467 flowchart LR
6dd74de468 classDef dark fill:#000,stroke:#000,stroke-width:4px,color:#fff
6dd74de469 Lorem --> Ipsum --> Dolor
6dd74de470 class Lorem,Dolor dark
6dd74de471 `,
6dd74de472 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de473 );
6dd74de474 });
6dd74de475 it('65-2: bold text from classes', () => {
6dd74de476 imgSnapshotTest(
6dd74de477 `
6dd74de478 flowchart
6dd74de479 classDef cat fill:#f9d5e5, stroke:#233d4d,stroke-width:2px, font-weight:bold;
6dd74de480 CS(A long bold text to be viewed):::cat
6dd74de481 `,
6dd74de482 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de483 );
6dd74de484 });
6dd74de485 it('65-3: bigger font from classes', () => {
6dd74de486 imgSnapshotTest(
6dd74de487 `
6dd74de488flowchart
6dd74de489 Node1:::class1 --> Node2:::class2
6dd74de490 Node1:::class1 --> Node3:::class2
6dd74de491 Node3 --> Node4((I am a circle)):::larger
6dd74de492
6dd74de493 classDef class1 fill:lightblue
6dd74de494 classDef class2 fill:pink
6dd74de495 classDef larger font-size:30px,fill:yellow
6dd74de496 `,
6dd74de497 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de498 );
6dd74de499 });
6dd74de500 it('66: More nested subgraph cases (TB)', () => {
6dd74de501 imgSnapshotTest(
6dd74de502 `
6dd74de503flowchart TB
6dd74de504 subgraph two
6dd74de505 b1
6dd74de506 end
6dd74de507 subgraph three
6dd74de508 c2
6dd74de509 end
6dd74de510
6dd74de511 three --> two
6dd74de512 two --> c2
6dd74de513
6dd74de514 `,
6dd74de515 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de516 );
6dd74de517 });
6dd74de518 it('67: More nested subgraph cases (RL)', () => {
6dd74de519 imgSnapshotTest(
6dd74de520 `
6dd74de521flowchart RL
6dd74de522 subgraph two
6dd74de523 b1
6dd74de524 end
6dd74de525 subgraph three
6dd74de526 c2
6dd74de527 end
6dd74de528
6dd74de529 three --> two
6dd74de530 two --> c2
6dd74de531
6dd74de532 `,
6dd74de533 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de534 );
6dd74de535 });
6dd74de536 it('68: More nested subgraph cases (BT)', () => {
6dd74de537 imgSnapshotTest(
6dd74de538 `
6dd74de539flowchart BT
6dd74de540 subgraph two
6dd74de541 b1
6dd74de542 end
6dd74de543 subgraph three
6dd74de544 c2
6dd74de545 end
6dd74de546
6dd74de547 three --> two
6dd74de548 two --> c2
6dd74de549
6dd74de550 `,
6dd74de551 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de552 );
6dd74de553 });
6dd74de554 it('69: More nested subgraph cases (LR)', () => {
6dd74de555 imgSnapshotTest(
6dd74de556 `
6dd74de557flowchart LR
6dd74de558 subgraph two
6dd74de559 b1
6dd74de560 end
6dd74de561 subgraph three
6dd74de562 c2
6dd74de563 end
6dd74de564
6dd74de565 three --> two
6dd74de566 two --> c2
6dd74de567
6dd74de568 `,
6dd74de569 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de570 );
6dd74de571 });
6dd74de572 it('70: Handle nested subgraph cases (TB) link out and link between subgraphs', () => {
6dd74de573 imgSnapshotTest(
6dd74de574 `
6dd74de575flowchart TB
6dd74de576 subgraph S1
6dd74de577 sub1 -->sub2
6dd74de578 end
6dd74de579 subgraph S2
6dd74de580 sub4
6dd74de581 end
6dd74de582 S1 --> S2
6dd74de583 sub1 --> sub4
6dd74de584 `,
6dd74de585 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de586 );
6dd74de587 });
6dd74de588 it('71: Handle nested subgraph cases (RL) link out and link between subgraphs', () => {
6dd74de589 imgSnapshotTest(
6dd74de590 `
6dd74de591flowchart RL
6dd74de592 subgraph S1
6dd74de593 sub1 -->sub2
6dd74de594 end
6dd74de595 subgraph S2
6dd74de596 sub4
6dd74de597 end
6dd74de598 S1 --> S2
6dd74de599 sub1 --> sub4
6dd74de600 `,
6dd74de601 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de602 );
6dd74de603 });
6dd74de604 it('72: Handle nested subgraph cases (BT) link out and link between subgraphs', () => {
6dd74de605 imgSnapshotTest(
6dd74de606 `
6dd74de607flowchart BT
6dd74de608 subgraph S1
6dd74de609 sub1 -->sub2
6dd74de610 end
6dd74de611 subgraph S2
6dd74de612 sub4
6dd74de613 end
6dd74de614 S1 --> S2
6dd74de615 sub1 --> sub4
6dd74de616 `,
6dd74de617 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de618 );
6dd74de619 });
6dd74de620 it('74: Handle nested subgraph cases (RL) link out and link between subgraphs', () => {
6dd74de621 imgSnapshotTest(
6dd74de622 `
6dd74de623flowchart RL
6dd74de624 subgraph S1
6dd74de625 sub1 -->sub2
6dd74de626 end
6dd74de627 subgraph S2
6dd74de628 sub4
6dd74de629 end
6dd74de630 S1 --> S2
6dd74de631 sub1 --> sub4
6dd74de632 `,
6dd74de633 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de634 );
6dd74de635 });
6dd74de636 it('74: Handle labels for multiple edges from and to the same couple of nodes', () => {
6dd74de637 imgSnapshotTest(
6dd74de638 `
6dd74de639flowchart RL
6dd74de640 subgraph one
6dd74de641 a1 -- l1 --> a2
6dd74de642 a1 -- l2 --> a2
6dd74de643 end
6dd74de644 `,
6dd74de645 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de646 );
6dd74de647 });
6dd74de648
6dd74de649 it('76: handle unicode encoded character with HTML labels true', () => {
6dd74de650 imgSnapshotTest(
6dd74de651 `flowchart TB
6dd74de652 a{{"Lorem 'ipsum' dolor 'sit' amet, 'consectetur' adipiscing 'elit'."}}
6dd74de653 --> b{{"Lorem #quot;ipsum#quot; dolor #quot;sit#quot; amet,#quot;consectetur#quot; adipiscing #quot;elit#quot;."}}
6dd74de654 `,
6dd74de655 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de656 );
6dd74de657 });
6dd74de658
6dd74de659 it('2050: handling of different rendering direction in subgraphs', () => {
6dd74de660 imgSnapshotTest(
6dd74de661 `
6dd74de662 flowchart LR
6dd74de663
6dd74de664 subgraph TOP
6dd74de665 direction TB
6dd74de666 subgraph B1
6dd74de667 direction RL
6dd74de668 i1 -->f1
6dd74de669 end
6dd74de670 subgraph B2
6dd74de671 direction BT
6dd74de672 i2 -->f2
6dd74de673 end
6dd74de674 end
6dd74de675 A --> TOP --> B
6dd74de676 B1 --> B2
6dd74de677 `,
6dd74de678 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de679 );
6dd74de680 });
6dd74de681
6dd74de682 it('2388: handling default in the node name', () => {
6dd74de683 imgSnapshotTest(
6dd74de684 `
6dd74de685 flowchart LR
6dd74de686 default-index.js --> dot.template.js
6dd74de687 index.js --> module-utl.js
6dd74de688 `,
6dd74de689 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de690 );
6dd74de691 });
6dd74de692 it('2824: Clipping of edges', () => {
6dd74de693 imgSnapshotTest(
6dd74de694 `
6dd74de695 flowchart TD
6dd74de696 A --> B
6dd74de697 A --> C
6dd74de698 B --> C
6dd74de699 `,
6dd74de700 { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
6dd74de701 );
6dd74de702 });
6dd74de703 it('1433: should render a titled flowchart with titleTopMargin set to 0', () => {
6dd74de704 imgSnapshotTest(
6dd74de705 `---
6dd74de706title: Simple flowchart
6dd74de707---
6dd74de708flowchart TD
6dd74de709A --> B
6dd74de710`,
6dd74de711 { flowchart: { titleTopMargin: 10 } }
6dd74de712 );
6dd74de713 });
6dd74de714 it('3192: It should be possible to render flowcharts with invisible edges', () => {
6dd74de715 imgSnapshotTest(
6dd74de716 `---
6dd74de717title: Simple flowchart with invisible edges
6dd74de718---
6dd74de719flowchart TD
6dd74de720A ~~~ B
6dd74de721`,
6dd74de722 { flowchart: { titleTopMargin: 10 } }
6dd74de723 );
6dd74de724 });
6dd74de725 it('4023: Should render html labels with images and-or text correctly', () => {
6dd74de726 imgSnapshotTest(
6dd74de727 `flowchart TD
6dd74de728 B[<img src='https://mermaid.js.org/mermaid-logo.svg'>]
6dd74de729 B-->C[<img src="https://mermaid.js.org/mermaid-logo.svg"> more text <img src='https://mermaid.js.org/mermaid-logo.svg'>]
6dd74de730 B-->D(<img src='https://mermaid.js.org/mermaid-logo.svg'> some text)
6dd74de731 B-->E(plain)`,
6dd74de732 {}
6dd74de733 );
6dd74de734 });
6dd74de735
6dd74de736 it('4439: Should render the graph even if some images are missing', () => {
6dd74de737 imgSnapshotTest(
6dd74de738 `flowchart TD
6dd74de739 B[<img>]
6dd74de740 B-->C[<img>]`,
6dd74de741 {}
6dd74de742 );
6dd74de743 });
6dd74de744
6dd74de745 it('5064: Should render when subgraph child has links to outside node and subgraph', () => {
6dd74de746 imgSnapshotTest(
6dd74de747 `flowchart TB
6dd74de748 Out --> In
6dd74de749 subgraph Sub
6dd74de750 In
6dd74de751 end
6dd74de752 Sub --> In`
6dd74de753 );
6dd74de754 });
6dd74de755
6dd74de756 it('5059: Should render when subgraph contains only subgraphs, has link to outside and itself is part of a link', () => {
6dd74de757 imgSnapshotTest(
6dd74de758 `flowchart
6dd74de759
6dd74de760 subgraph Main
6dd74de761 subgraph Child1
6dd74de762 Node1
6dd74de763 Node2
6dd74de764 end
6dd74de765 subgraph Child2
6dd74de766 Node3
6dd74de767 Node4
6dd74de768 end
6dd74de769 end
6dd74de770 Main --> Out1
6dd74de771 Child2 --> Out2`
6dd74de772 );
6dd74de773 });
6dd74de774
6dd74de775 it('3258: Should render subgraphs with main graph nodeSpacing and rankSpacing', () => {
6dd74de776 imgSnapshotTest(
6dd74de777 `---
6dd74de778 title: Subgraph nodeSpacing and rankSpacing example
6dd74de779 ---
6dd74de780 flowchart LR
6dd74de781 X --> Y
6dd74de782 subgraph X
6dd74de783 direction LR
6dd74de784 A
6dd74de785 C
6dd74de786 end
6dd74de787 subgraph Y
6dd74de788 B
6dd74de789 D
6dd74de790 end
6dd74de791 `,
6dd74de792 { flowchart: { nodeSpacing: 1, rankSpacing: 1 } }
6dd74de793 );
6dd74de794 });
6dd74de795
6dd74de796 it('3258: Should render subgraphs with large nodeSpacing and rankSpacing', () => {
6dd74de797 imgSnapshotTest(
6dd74de798 `---
6dd74de799 title: Subgraph nodeSpacing and rankSpacing example
6dd74de800 config:
6dd74de801 flowchart:
6dd74de802 nodeSpacing: 250
6dd74de803 rankSpacing: 250
6dd74de804 ---
6dd74de805 flowchart LR
6dd74de806 X --> Y
6dd74de807 subgraph X
6dd74de808 direction LR
6dd74de809 A
6dd74de810 C
6dd74de811 end
6dd74de812 subgraph Y
6dd74de813 B
6dd74de814 D
6dd74de815 end
6dd74de816 `
6dd74de817 );
6dd74de818 });
6dd74de819
6dd74de820 describe('Markdown strings flowchart (#4220)', () => {
6dd74de821 describe('html labels', () => {
6dd74de822 it('With styling and classes', () => {
6dd74de823 imgSnapshotTest(
6dd74de824 `%%{init: {"flowchart": {"htmlLabels": true}} }%%
6dd74de825flowchart LR
6dd74de826 A:::someclass --> B["\`The **cat** in the hat\`"]:::someclass
6dd74de827 id1(Start)-->id2(Stop)
6dd74de828 style id1 fill:#f9f,stroke:#333,stroke-width:4px
6dd74de829 style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
6dd74de830 classDef someclass fill:#f96
6dd74de831`,
6dd74de832 { flowchart: { titleTopMargin: 0 } }
6dd74de833 );
6dd74de834 });
6dd74de835 it('With formatting in a node', () => {
6dd74de836 imgSnapshotTest(
6dd74de837 `%%{init: {"flowchart": {"htmlLabels": true}} }%%
6dd74de838flowchart LR
6dd74de839 a{"\`The **cat** in the hat\`"} -- 1o --> b
6dd74de840 a -- 2o --> c
6dd74de841 a -- 3o --> d
6dd74de842 g --2i--> a
6dd74de843 d --1i--> a
6dd74de844 h --3i -->a
6dd74de845 b --> d(The dog in the hog)
6dd74de846 c --> d
6dd74de847`,
6dd74de848 { flowchart: { titleTopMargin: 0 } }
6dd74de849 );
6dd74de850 });
6dd74de851 it('New line in node and formatted edge label', () => {
6dd74de852 imgSnapshotTest(
6dd74de853 `%%{init: {"flowchart": {"htmlLabels": true}} }%%
6dd74de854flowchart LR
6dd74de855b("\`The dog in **the** hog.(1)
6dd74de856NL\`") --"\`1o **bold**\`"--> c
6dd74de857`,
6dd74de858 { flowchart: { titleTopMargin: 0 } }
6dd74de859 );
6dd74de860 });
6dd74de861 it('Wrapping long text with a new line', () => {
6dd74de862 imgSnapshotTest(
6dd74de863 `%%{init: {"flowchart": {"htmlLabels": true}} }%%
6dd74de864flowchart LR
6dd74de865b("\`The dog in **the** hog.(1).. a a a a *very long text* about it
6dd74de866Word!
6dd74de867
6dd74de868Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
6dd74de869
6dd74de870`,
6dd74de871 { flowchart: { titleTopMargin: 0 } }
6dd74de872 );
6dd74de873 });
6dd74de874 it('Sub graphs and markdown strings', () => {
6dd74de875 imgSnapshotTest(
6dd74de876 `%%{init: {"flowchart": {"htmlLabels": true}} }%%
6dd74de877flowchart LR
6dd74de878subgraph "One"
6dd74de879 a("\`The **cat**
6dd74de880 in the hat\`") -- "1o" --> b{{"\`The **dog** in the hog\`"}}
6dd74de881end
6dd74de882subgraph "\`**Two**\`"
6dd74de883 c("\`The **cat**
6dd74de884 in the hat\`") -- "\`1o **ipa**\`" --> d("The dog in the hog")
6dd74de885end
6dd74de886
6dd74de887`,
6dd74de888 { flowchart: { titleTopMargin: 0 } }
6dd74de889 );
6dd74de890 });
6dd74de891 });
6dd74de892
6dd74de893 describe('svg text labels', () => {
6dd74de894 it('With styling and classes', () => {
6dd74de895 imgSnapshotTest(
6dd74de896 `%%{init: {"flowchart": {"htmlLabels": false}} }%%
6dd74de897flowchart LR
6dd74de898 A:::someclass --> B["\`The **cat** in the hat\`"]:::someclass
6dd74de899 id1(Start)-->id2(Stop)
6dd74de900 style id1 fill:#f9f,stroke:#333,stroke-width:4px
6dd74de901 style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
6dd74de902 classDef someclass fill:#f96
6dd74de903`,
6dd74de904 { flowchart: { titleTopMargin: 0 } }
6dd74de905 );
6dd74de906 });
6dd74de907 it('With formatting in a node', () => {
6dd74de908 imgSnapshotTest(
6dd74de909 `%%{init: {"flowchart": {"htmlLabels": false}} }%%
6dd74de910flowchart LR
6dd74de911 a{"\`The **cat** in the hat\`"} -- 1o --> b
6dd74de912 a -- 2o --> c
6dd74de913 a -- 3o --> d
6dd74de914 g --2i--> a
6dd74de915 d --1i--> a
6dd74de916 h --3i -->a
6dd74de917 b --> d(The dog in the hog)
6dd74de918 c --> d
6dd74de919`,
6dd74de920 { flowchart: { titleTopMargin: 0 } }
6dd74de921 );
6dd74de922 });
6dd74de923 it('New line in node and formatted edge label', () => {
6dd74de924 imgSnapshotTest(
6dd74de925 `%%{init: {"flowchart": {"htmlLabels": false}} }%%
6dd74de926flowchart LR
6dd74de927b("\`The dog in **the** hog.(1)
6dd74de928NL\`") --"\`1o **bold**\`"--> c
6dd74de929`,
6dd74de930 { flowchart: { titleTopMargin: 0 } }
6dd74de931 );
6dd74de932 });
6dd74de933 it('Wrapping long text with a new line', () => {
6dd74de934 imgSnapshotTest(
6dd74de935 `%%{init: {"flowchart": {"htmlLabels": false}} }%%
6dd74de936flowchart LR
6dd74de937b("\`The dog in **the** hog.(1).. a a a a *very long text* about it
6dd74de938Word!
6dd74de939
6dd74de940Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
6dd74de941
6dd74de942`,
6dd74de943 { flowchart: { titleTopMargin: 0 } }
6dd74de944 );
6dd74de945 });
6dd74de946 it('Sub graphs and markdown strings', () => {
6dd74de947 imgSnapshotTest(
6dd74de948 `%%{init: {"flowchart": {"htmlLabels": false}} }%%
6dd74de949flowchart LR
6dd74de950subgraph "One"
6dd74de951 a("\`The **cat**
6dd74de952 in the hat\`") -- "1o" --> b{{"\`The **dog** in the hog\`"}}
6dd74de953end
6dd74de954subgraph "\`**Two**\`"
6dd74de955 c("\`The **cat**
6dd74de956 in the hat\`") -- "\`1o **ipa**\`" --> d("The dog in the hog")
6dd74de957end
6dd74de958
6dd74de959`,
6dd74de960 { flowchart: { titleTopMargin: 0 } }
6dd74de961 );
6dd74de962 });
6dd74de963 });
6dd74de964
6dd74de965 it('should not auto wrap when markdownAutoWrap is false', () => {
6dd74de966 imgSnapshotTest(
6dd74de967 `flowchart TD
6dd74de968 angular_velocity["\`**angular_velocity**
6dd74de969 *angular_displacement / duration*
6dd74de970 [rad/s, 1/s]
6dd74de971 {vector}\`"]
6dd74de972 frequency["frequency\n(1 / period_duration)\n[Hz, 1/s]"]`,
6dd74de973 { markdownAutoWrap: false }
6dd74de974 );
6dd74de975 });
6dd74de976 });
6dd74de977 describe('Subgraph title margins', () => {
6dd74de978 it('Should render subgraphs with title margins set (LR)', () => {
6dd74de979 imgSnapshotTest(
6dd74de980 `flowchart LR
6dd74de981
6dd74de982 subgraph TOP
6dd74de983 direction TB
6dd74de984 subgraph B1
6dd74de985 direction RL
6dd74de986 i1 -->f1
6dd74de987 end
6dd74de988 subgraph B2
6dd74de989 direction BT
6dd74de990 i2 -->f2
6dd74de991 end
6dd74de992 end
6dd74de993 A --> TOP --> B
6dd74de994 B1 --> B2
6dd74de995 `,
6dd74de996 { flowchart: { subGraphTitleMargin: { top: 10, bottom: 5 } } }
6dd74de997 );
6dd74de998 });
6dd74de999 it('Should render subgraphs with title margins set (TD)', () => {
6dd74de1000 imgSnapshotTest(
6dd74de1001 `flowchart TD
6dd74de1002
6dd74de1003 subgraph TOP
6dd74de1004 direction LR
6dd74de1005 subgraph B1
6dd74de1006 direction RL
6dd74de1007 i1 -->f1
6dd74de1008 end
6dd74de1009 subgraph B2
6dd74de1010 direction BT
6dd74de1011 i2 -->f2
6dd74de1012 end
6dd74de1013 end
6dd74de1014 A --> TOP --> B
6dd74de1015 B1 --> B2
6dd74de1016 `,
6dd74de1017 { flowchart: { subGraphTitleMargin: { top: 8, bottom: 16 } } }
6dd74de1018 );
6dd74de1019 });
6dd74de1020 it('Should render subgraphs with title margins set (LR) and htmlLabels set to false', () => {
6dd74de1021 imgSnapshotTest(
6dd74de1022 `flowchart LR
6dd74de1023
6dd74de1024 subgraph TOP
6dd74de1025 direction TB
6dd74de1026 subgraph B1
6dd74de1027 direction RL
6dd74de1028 i1 -->f1
6dd74de1029 end
6dd74de1030 subgraph B2
6dd74de1031 direction BT
6dd74de1032 i2 -->f2
6dd74de1033 end
6dd74de1034 end
6dd74de1035 A --> TOP --> B
6dd74de1036 B1 --> B2
6dd74de1037 `,
6dd74de1038 {
6dd74de1039 htmlLabels: false,
6dd74de1040 flowchart: { htmlLabels: false, subGraphTitleMargin: { top: 10, bottom: 5 } },
6dd74de1041 }
6dd74de1042 );
6dd74de1043 });
6dd74de1044 it('Should render subgraphs with title margins and edge labels', () => {
6dd74de1045 imgSnapshotTest(
6dd74de1046 `flowchart LR
6dd74de1047
6dd74de1048 subgraph TOP
6dd74de1049 direction TB
6dd74de1050 subgraph B1
6dd74de1051 direction RL
6dd74de1052 i1 --lb1-->f1
6dd74de1053 end
6dd74de1054 subgraph B2
6dd74de1055 direction BT
6dd74de1056 i2 --lb2-->f2
6dd74de1057 end
6dd74de1058 end
6dd74de1059 A --lb3--> TOP --lb4--> B
6dd74de1060 B1 --lb5--> B2
6dd74de1061 `,
6dd74de1062 {
6dd74de1063 flowchart: { subGraphTitleMargin: { top: 10, bottom: 5 } },
6dd74de1064 }
6dd74de1065 );
6dd74de1066 });
6dd74de1067 it('Should render self-loops', () => {
6dd74de1068 imgSnapshotTest(
6dd74de1069 `flowchart
6dd74de1070 A --> A
6dd74de1071 subgraph B
6dd74de1072 B1 --> B1
6dd74de1073 end
6dd74de1074 subgraph C
6dd74de1075 subgraph C1
6dd74de1076 C2 --> C2
6dd74de1077 subgraph D
6dd74de1078 D1 --> D1
6dd74de1079 end
6dd74de1080 D --> D
6dd74de1081 end
6dd74de1082 C1 --> C1
6dd74de1083 end
6dd74de1084 `,
6dd74de1085 {
6dd74de1086 flowchart: { subGraphTitleMargin: { top: 10, bottom: 5 } },
6dd74de1087 }
6dd74de1088 );
6dd74de1089 });
6dd74de1090 });
6dd74de1091 describe('New @ syntax for node metadata edge cases', () => {
6dd74de1092 it('should be possible to use @ syntax to add labels on multi nodes', () => {
6dd74de1093 imgSnapshotTest(
6dd74de1094 `flowchart TB
6dd74de1095 n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"}
6dd74de1096 `,
6dd74de1097 {}
6dd74de1098 );
6dd74de1099 });
6dd74de1100 it('should be possible to use @ syntax to add labels with trail spaces and &', () => {
6dd74de1101 imgSnapshotTest(
6dd74de1102 `flowchart TB
6dd74de1103 n2["label for n2"] & n4@{ label: "label for n4"} & n5@{ label: "label for n5"}
6dd74de1104 `,
6dd74de1105 {}
6dd74de1106 );
6dd74de1107 });
6dd74de1108 it('should be possible to use @ syntax to add labels with trail spaces', () => {
6dd74de1109 imgSnapshotTest(
6dd74de1110 `flowchart TB
6dd74de1111 n2["label for n2"]
6dd74de1112 n4@{ label: "label for n4"}
6dd74de1113 n5@{ label: "label for n5"}
6dd74de1114 `,
6dd74de1115 {}
6dd74de1116 );
6dd74de1117 });
6dd74de1118 it('should be possible to use @ syntax to add labels with trail spaces and edge/link', () => {
6dd74de1119 imgSnapshotTest(
6dd74de1120 `flowchart TD
6dd74de1121 A["A"] --> B["for B"] & C@{ label: "for c"} & E@{label : "for E"}
6dd74de1122 D@{label: "for D"}
6dd74de1123 `,
6dd74de1124 {}
6dd74de1125 );
6dd74de1126 });
6dd74de1127 });
6dd74de1128 describe('Flowchart Node Shape Rendering', () => {
6dd74de1129 it('should render a stadium-shaped node', () => {
6dd74de1130 imgSnapshotTest(
6dd74de1131 `flowchart TB
6dd74de1132 A(["Start"]) --> n1["Untitled Node"]
6dd74de1133 A --> n2["Untitled Node"]
6dd74de1134 `,
6dd74de1135 {}
6dd74de1136 );
6dd74de1137 });
6dd74de1138 it('should render a diamond-shaped node using shape config', () => {
6dd74de1139 imgSnapshotTest(
6dd74de1140 `flowchart BT
6dd74de1141 n2["Untitled Node"] --> n1["Diamond"]
6dd74de1142 n1@{ shape: diam}
6dd74de1143 `,
6dd74de1144 {}
6dd74de1145 );
6dd74de1146 });
6dd74de1147 it('should render a rounded rectangle and a normal rectangle', () => {
6dd74de1148 imgSnapshotTest(
6dd74de1149 `flowchart BT
6dd74de1150 n2["Untitled Node"] --> n1["Rounded Rectangle"]
6dd74de1151 n3["Untitled Node"] --> n1
6dd74de1152 n1@{ shape: rounded}
6dd74de1153 n3@{ shape: rect}
6dd74de1154 `,
6dd74de1155 {}
6dd74de1156 );
6dd74de1157 });
6dd74de1158 });
6dd74de1159
6dd74de1160 it('6617: Per Link Curve Styling using edge Ids', () => {
6dd74de1161 imgSnapshotTest(
6dd74de1162 `flowchart TD
6dd74de1163 A e1@-->B e5@--> E
6dd74de1164 E e7@--> D
6dd74de1165 B e3@-->D
6dd74de1166 A e2@-->C e4@-->D
6dd74de1167 C e6@--> F
6dd74de1168 F e8@--> D
6dd74de1169 e1@{ curve: natural }
6dd74de1170 e2@{ curve: stepAfter }
6dd74de1171 e3@{ curve: monotoneY }
6dd74de1172 e4@{ curve: bumpY }
6dd74de1173 e5@{ curve: linear }
6dd74de1174 e6@{ curve: catmullRom }
6dd74de1175 e7@{ curve: cardinal }
6dd74de1176 `
6dd74de1177 );
6dd74de1178 });
6dd74de1179
6dd74de1180 describe('when rendering unsuported markdown', () => {
6dd74de1181 const graph = `flowchart TB
6dd74de1182 mermaid{"What is\nyourmermaid version?"} --> v10["<11"] --"\`<**1**1\`"--> fine["No bug"]
6dd74de1183 mermaid --> v11[">= v11"] -- ">= v11" --> broken["Affected by https://github.com/mermaid-js/mermaid/issues/5824"]
6dd74de1184 subgraph subgraph1["\`How to fix **fix**\`"]
6dd74de1185 broken --> B["B"]
6dd74de1186 end
6dd74de1187 githost["Github, Gitlab, BitBucket, etc."]
6dd74de1188 githost2["\`Github, Gitlab, BitBucket, etc.\`"]
6dd74de1189 a["1."]
6dd74de1190 b["- x"]
6dd74de1191 `;
6dd74de1192
6dd74de1193 it('should render raw strings', () => {
6dd74de1194 imgSnapshotTest(graph);
6dd74de1195 });
6dd74de1196
6dd74de1197 it('should render raw strings with htmlLabels: false', () => {
6dd74de1198 imgSnapshotTest(graph, { htmlLabels: false });
6dd74de1199 });
6dd74de1200 });
6dd74de1201
6dd74de1202 it('V2 - 17: should apply class def colour to edge label', () => {
6dd74de1203 imgSnapshotTest(
6dd74de1204 ` graph LR
6dd74de1205 id1(Start) link@-- "Label" -->id2(Stop)
6dd74de1206 style id1 fill:#f9f,stroke:#333,stroke-width:4px
6dd74de1207
6dd74de1208class id2 myClass
6dd74de1209classDef myClass fill:#bbf,stroke:#f66,stroke-width:2px,color:white,stroke-dasharray: 5 5
6dd74de1210class link myClass
6dd74de1211`
6dd74de1212 );
6dd74de1213 });
6dd74de1214});