collab/mermaid/cypress/integration/rendering/gantt.spec.jsblame
View source
6dd74de1import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
6dd74de2
6dd74de3describe('Gantt diagram', () => {
6dd74de4 beforeEach(() => {
6dd74de5 cy.clock(new Date('1010-10-10').getTime());
6dd74de6 });
6dd74de7 it('should render a gantt chart', () => {
6dd74de8 imgSnapshotTest(
6dd74de9 `
6dd74de10 gantt
6dd74de11 dateFormat YYYY-MM-DD
6dd74de12 axisFormat %d/%m
6dd74de13 title Adding GANTT diagram to mermaid
6dd74de14 excludes weekdays 2014-01-10
6dd74de15
6dd74de16 section A section
6dd74de17 Completed task :done, des1, 2014-01-06,2014-01-08
6dd74de18 Active task :active, des2, 2014-01-09, 3d
6dd74de19 Future task : des3, after des2, 5d
6dd74de20 Future task2 : des4, after des3, 5d
6dd74de21
6dd74de22 section Critical tasks
6dd74de23 Completed task in the critical line :crit, done, 2014-01-06,24h
6dd74de24 Implement parser and jison :crit, done, after des1, 2d
6dd74de25 Create tests for parser :crit, active, 3d
6dd74de26 Future task in critical line :crit, 5d
6dd74de27 Create tests for renderer :2d
6dd74de28 Add to mermaid :1d
6dd74de29
6dd74de30 section Documentation
6dd74de31 Describe gantt syntax :active, a1, after des1, 3d
6dd74de32 Add gantt diagram to demo page :after a1 , 20h
6dd74de33 Add another diagram to demo page :doc1, after a1 , 48h
6dd74de34
6dd74de35 section Last section
6dd74de36 Describe gantt syntax :after doc1, 3d
6dd74de37 Add gantt diagram to demo page : 20h
6dd74de38 Add another diagram to demo page : 48h
6dd74de39 `,
6dd74de40 {}
6dd74de41 );
6dd74de42 });
6dd74de43 it('Handle multiline section titles with different line breaks', () => {
6dd74de44 imgSnapshotTest(
6dd74de45 `
6dd74de46 gantt
6dd74de47 dateFormat YYYY-MM-DD
6dd74de48 axisFormat %d/%m
6dd74de49 title GANTT diagram with multiline section titles
6dd74de50 excludes weekdays 2014-01-10
6dd74de51
6dd74de52 section A section<br>multiline
6dd74de53 Completed task : done, des1, 2014-01-06,2014-01-08
6dd74de54 Active task : active, des2, 2014-01-09, 3d
6dd74de55 Future task : des3, after des2, 5d
6dd74de56 Future task2 : des4, after des3, 5d
6dd74de57
6dd74de58 section Critical tasks<br/>multiline
6dd74de59 Completed task in the critical line : crit, done, 2014-01-06, 24h
6dd74de60 Implement parser and jison : crit, done, after des1, 2d
6dd74de61 Create tests for parser : crit, active, 3d
6dd74de62 Future task in critical line : crit, 5d
6dd74de63 Create tests for renderer : 2d
6dd74de64 Add to mermaid : 1d
6dd74de65
6dd74de66 section Documentation<br />multiline
6dd74de67 Describe gantt syntax : active, a1, after des1, 3d
6dd74de68 Add gantt diagram to demo page : after a1, 20h
6dd74de69 Add another diagram to demo page : doc1, after a1, 48h
6dd74de70
6dd74de71 section Last section<br />multiline
6dd74de72 Describe gantt syntax : after doc1, 3d
6dd74de73 Add gantt diagram to demo page : 20h
6dd74de74 Add another diagram to demo page : 48h
6dd74de75 `,
6dd74de76 {}
6dd74de77 );
6dd74de78 });
6dd74de79 it('Multiple dependencies syntax', () => {
6dd74de80 imgSnapshotTest(
6dd74de81 `
6dd74de82 gantt
6dd74de83 dateFormat YYYY-MM-DD
6dd74de84 axisFormat %d/%m
6dd74de85 title Adding GANTT diagram to mermaid
6dd74de86 excludes weekdays 2014-01-10
6dd74de87
6dd74de88 apple :a, 2017-07-20, 1w
6dd74de89 banana :crit, b, 2017-07-23, 1d
6dd74de90 cherry :active, c, after b a, 1d
6dd74de91 `,
6dd74de92 {}
6dd74de93 );
6dd74de94 });
6dd74de95 it('should handle multiple dependencies syntax with after and until', () => {
6dd74de96 imgSnapshotTest(
6dd74de97 `
6dd74de98 gantt
6dd74de99 dateFormat YYYY-MM-DD
6dd74de100 axisFormat %d/%m
6dd74de101 title Adding GANTT diagram to mermaid
6dd74de102 excludes weekdays 2014-01-10
6dd74de103 todayMarker off
6dd74de104
6dd74de105 section team's critical event
6dd74de106 deadline A :milestone, crit, deadlineA, 2024-02-01, 0
6dd74de107 deadline B :milestone, crit, deadlineB, 2024-02-15, 0
6dd74de108 boss on leave :bossaway, 2024-01-28, 2024-02-11
6dd74de109
6dd74de110 section new intern
6dd74de111 onboarding :onboarding, 2024-01-02, 1w
6dd74de112 literature review :litreview, 2024-01-02, 10d
6dd74de113 project A :projectA, after onboarding litreview, until deadlineA bossaway
6dd74de114 chilling :chilling, after projectA, until deadlineA
6dd74de115 project B :projectB, after deadlineA, until deadlineB
6dd74de116 `,
6dd74de117 {}
6dd74de118 );
6dd74de119 });
6dd74de120 it('should FAIL rendering a gantt chart for issue #1060 with invalid date', () => {
6dd74de121 imgSnapshotTest(
6dd74de122 `
6dd74de123 gantt
6dd74de124 excludes weekdays 2017-01-10
6dd74de125 title Projects Timeline
6dd74de126
6dd74de127 section asdf
6dd74de128 specs :done, :ps, 2019-05-10, 50d
6dd74de129 Plasma :pc, 2019-06-20, 60d
6dd74de130 Rollup :or, 2019-08-20, 50d
6dd74de131
6dd74de132 section CEL
6dd74de133
6dd74de134 plasma-chamber :done, :pc, 2019-05-20, 60d
6dd74de135 Plasma Implementation (Rust) :por, 2019-06-20, 120d
6dd74de136 Predicates (Atomic Swap) :pred, 2019-07-20, 60d
6dd74de137
6dd74de138 section DEX
6dd74de139
6dd74de140 History zkSNARK :hs, 2019-08-10, 40d
6dd74de141 Exit :vs, after hs, 60d
6dd74de142 PredicateSpec :ps, 2019-09-1, 20d
6dd74de143 PlasmaIntegration :pi, after ps,40d
6dd74de144
6dd74de145
6dd74de146 section Events
6dd74de147
6dd74de148 ETHBoston :done, :eb, 2019-09-08, 3d
6dd74de149 DevCon :active, :dc, 2019-10-08, 3d
6dd74de150
6dd74de151 section Plasma Calls & updates
6dd74de152 OVM :ovm, 2019-07-12, 120d
6dd74de153 Plasma call 26 :pc26, 2019-08-21, 1d
6dd74de154 Plasma call 27 :pc27, 2019-09-03, 1d
6dd74de155 Plasma call 28 :pc28, 2019-09-17, 1d
6dd74de156 `,
6dd74de157 {}
6dd74de158 );
6dd74de159 });
6dd74de160
6dd74de161 it('should default to showing today marker', () => {
6dd74de162 // This test only works if the environment thinks today is 1010-10-10
6dd74de163 imgSnapshotTest(
6dd74de164 `
6dd74de165 gantt
6dd74de166 title Show today marker (vertical line should be visible)
6dd74de167 dateFormat YYYY-MM-DD
6dd74de168 axisFormat %d
6dd74de169 %% Should default to being on
6dd74de170 %% todayMarker on
6dd74de171 section Section1
6dd74de172 Yesterday: 1010-10-09, 1d
6dd74de173 Today: 1010-10-10, 1d
6dd74de174 `,
6dd74de175 {}
6dd74de176 );
6dd74de177 });
6dd74de178
6dd74de179 it('should hide today marker', () => {
6dd74de180 imgSnapshotTest(
6dd74de181 `
6dd74de182 gantt
6dd74de183 title Hide today marker (vertical line should not be visible)
6dd74de184 dateFormat YYYY-MM-DD
6dd74de185 axisFormat %d
6dd74de186 todayMarker off
6dd74de187 section Section1
6dd74de188 Yesterday: 1010-10-09, 1d
6dd74de189 Today: 1010-10-10, 1d
6dd74de190 `,
6dd74de191 {}
6dd74de192 );
6dd74de193 });
6dd74de194
6dd74de195 it('should style today marker', () => {
6dd74de196 imgSnapshotTest(
6dd74de197 `
6dd74de198 gantt
6dd74de199 title Style today marker (vertical line should be 5px wide and half-transparent blue)
6dd74de200 dateFormat YYYY-MM-DD
6dd74de201 axisFormat %d
6dd74de202 todayMarker stroke-width:5px,stroke:#00f,opacity:0.5
6dd74de203 section Section1
6dd74de204 Yesterday: 1010-10-09, 1d
6dd74de205 Today: 1010-10-10, 1d
6dd74de206 `,
6dd74de207 {}
6dd74de208 );
6dd74de209 });
6dd74de210
6dd74de211 it('should handle milliseconds', () => {
6dd74de212 imgSnapshotTest(
6dd74de213 `
6dd74de214 gantt
6dd74de215 title A Gantt Diagram
6dd74de216 dateFormat x
6dd74de217 axisFormat %L
6dd74de218 section Section
6dd74de219 A task :a1, 0, 30ms
6dd74de220 Another task :after a1, 20ms
6dd74de221 section Another
6dd74de222 Another another task :b1, 20, 12ms
6dd74de223 Another another another task :after b1, 0.024s
6dd74de224 `,
6dd74de225 {}
6dd74de226 );
6dd74de227 });
6dd74de228
6dd74de229 it('should render a gantt diagram when useMaxWidth is true (default)', () => {
6dd74de230 renderGraph(
6dd74de231 `
6dd74de232 gantt
6dd74de233 dateFormat YYYY-MM-DD
6dd74de234 axisFormat %d/%m
6dd74de235 title Adding GANTT diagram to mermaid
6dd74de236 excludes weekdays 2014-01-10
6dd74de237
6dd74de238 section A section
6dd74de239 Completed task :done, des1, 2014-01-06,2014-01-08
6dd74de240 Active task :active, des2, 2014-01-09, 3d
6dd74de241 Future task : des3, after des2, 5d
6dd74de242 Future task2 : des4, after des3, 5d
6dd74de243
6dd74de244 section Critical tasks
6dd74de245 Completed task in the critical line :crit, done, 2014-01-06,24h
6dd74de246 Implement parser and jison :crit, done, after des1, 2d
6dd74de247 Create tests for parser :crit, active, 3d
6dd74de248 Future task in critical line :crit, 5d
6dd74de249 Create tests for renderer :2d
6dd74de250 Add to mermaid :1d
6dd74de251
6dd74de252 section Documentation
6dd74de253 Describe gantt syntax :active, a1, after des1, 3d
6dd74de254 Add gantt diagram to demo page :after a1 , 20h
6dd74de255 Add another diagram to demo page :doc1, after a1 , 48h
6dd74de256
6dd74de257 section Last section
6dd74de258 Describe gantt syntax :after doc1, 3d
6dd74de259 Add gantt diagram to demo page : 20h
6dd74de260 Add another diagram to demo page : 48h
6dd74de261 `,
6dd74de262 { gantt: { useMaxWidth: true } }
6dd74de263 );
6dd74de264 cy.get('svg').should((svg) => {
6dd74de265 expect(svg).to.have.attr('width', '100%');
6dd74de266 // expect(svg).to.have.attr('height');
6dd74de267 // use within because the absolute value can be slightly different depending on the environment ±5%
6dd74de268 // const height = parseFloat(svg.attr('height'));
6dd74de269 // expect(height).to.be.within(484 * 0.95, 484 * 1.05);
6dd74de270 const style = svg.attr('style');
6dd74de271 expect(style).to.match(/^max-width: [\d.]+px;$/);
6dd74de272 const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
6dd74de273 expect(maxWidthValue).to.be.within(
6dd74de274 Cypress.config().viewportWidth * 0.95,
6dd74de275 Cypress.config().viewportWidth * 1.05
6dd74de276 );
6dd74de277 });
6dd74de278 });
6dd74de279
6dd74de280 it('should render a gantt diagram when useMaxWidth is false', () => {
6dd74de281 renderGraph(
6dd74de282 `
6dd74de283 gantt
6dd74de284 dateFormat YYYY-MM-DD
6dd74de285 axisFormat %d/%m
6dd74de286 title Adding GANTT diagram to mermaid
6dd74de287 excludes weekdays 2014-01-10
6dd74de288
6dd74de289 section A section
6dd74de290 Completed task :done, des1, 2014-01-06,2014-01-08
6dd74de291 Active task :active, des2, 2014-01-09, 3d
6dd74de292 Future task : des3, after des2, 5d
6dd74de293 Future task2 : des4, after des3, 5d
6dd74de294
6dd74de295 section Critical tasks
6dd74de296 Completed task in the critical line :crit, done, 2014-01-06,24h
6dd74de297 Implement parser and jison :crit, done, after des1, 2d
6dd74de298 Create tests for parser :crit, active, 3d
6dd74de299 Future task in critical line :crit, 5d
6dd74de300 Create tests for renderer :2d
6dd74de301 Add to mermaid :1d
6dd74de302
6dd74de303 section Documentation
6dd74de304 Describe gantt syntax :active, a1, after des1, 3d
6dd74de305 Add gantt diagram to demo page :after a1 , 20h
6dd74de306 Add another diagram to demo page :doc1, after a1 , 48h
6dd74de307
6dd74de308 section Last section
6dd74de309 Describe gantt syntax :after doc1, 3d
6dd74de310 Add gantt diagram to demo page : 20h
6dd74de311 Add another diagram to demo page : 48h
6dd74de312 `,
6dd74de313 { gantt: { useMaxWidth: false } }
6dd74de314 );
6dd74de315 cy.get('svg').should((svg) => {
6dd74de316 const width = parseFloat(svg.attr('width'));
6dd74de317 expect(width).to.be.within(
6dd74de318 Cypress.config().viewportWidth * 0.95,
6dd74de319 Cypress.config().viewportWidth * 1.05
6dd74de320 );
6dd74de321 expect(svg).to.not.have.attr('style');
6dd74de322 });
6dd74de323 });
6dd74de324 it('should render a gantt diagram with data labels at the top when topAxis is true', () => {
6dd74de325 imgSnapshotTest(
6dd74de326 `
6dd74de327 gantt
6dd74de328 dateFormat YYYY-MM-DD
6dd74de329 axisFormat %d/%m
6dd74de330 title Adding GANTT diagram to mermaid
6dd74de331 excludes weekdays 2014-01-10
6dd74de332
6dd74de333 section A section
6dd74de334 Completed task :done, des1, 2014-01-06,2014-01-08
6dd74de335 Active task :active, des2, 2014-01-09, 3d
6dd74de336 Future task : des3, after des2, 5d
6dd74de337 Future task2 : des4, after des3, 5d
6dd74de338
6dd74de339 section Critical tasks
6dd74de340 Completed task in the critical line :crit, done, 2014-01-06,24h
6dd74de341 Implement parser and jison :crit, done, after des1, 2d
6dd74de342 Create tests for parser :crit, active, 3d
6dd74de343 Future task in critical line :crit, 5d
6dd74de344 Create tests for renderer :2d
6dd74de345 Add to mermaid :1d
6dd74de346
6dd74de347 section Documentation
6dd74de348 Describe gantt syntax :active, a1, after des1, 3d
6dd74de349 Add gantt diagram to demo page :after a1 , 20h
6dd74de350 Add another diagram to demo page :doc1, after a1 , 48h
6dd74de351
6dd74de352 section Last section
6dd74de353 Describe gantt syntax :after doc1, 3d
6dd74de354 Add gantt diagram to demo page : 20h
6dd74de355 Add another diagram to demo page : 48h
6dd74de356 `,
6dd74de357 { gantt: { topAxis: true } }
6dd74de358 );
6dd74de359 });
6dd74de360
6dd74de361 it('should render a gantt diagram with a vert tag', () => {
6dd74de362 imgSnapshotTest(
6dd74de363 `
6dd74de364 gantt
6dd74de365 title A Gantt Diagram
6dd74de366 dateFormat ss
6dd74de367 axisFormat %Ss
6dd74de368
6dd74de369 section Section
6dd74de370 A task : a1, 00, 6s
6dd74de371 Milestone : vert, 01,
6dd74de372 section Another
6dd74de373 Task in sec : 06, 3s
6dd74de374 another task : 3s
6dd74de375 `
6dd74de376 );
6dd74de377 });
6dd74de378 it('should render a gantt diagram with tick is 2 milliseconds', () => {
6dd74de379 imgSnapshotTest(
6dd74de380 `
6dd74de381 gantt
6dd74de382 title A Gantt Diagram
6dd74de383 dateFormat SSS
6dd74de384 axisFormat %Lms
6dd74de385 tickInterval 2millisecond
6dd74de386 excludes weekends
6dd74de387
6dd74de388 section Section
6dd74de389 A task : a1, 000, 6ms
6dd74de390 Another task : after a1, 6ms
6dd74de391 section Another
6dd74de392 Task in sec : a2, 006, 3ms
6dd74de393 another task : 3ms
6dd74de394 `,
6dd74de395 {}
6dd74de396 );
6dd74de397 });
6dd74de398
6dd74de399 it('should render a gantt diagram with tick is 2 seconds', () => {
6dd74de400 imgSnapshotTest(
6dd74de401 `
6dd74de402 gantt
6dd74de403 title A Gantt Diagram
6dd74de404 dateFormat ss
6dd74de405 axisFormat %Ss
6dd74de406 tickInterval 2second
6dd74de407 excludes weekends
6dd74de408
6dd74de409 section Section
6dd74de410 A task : a1, 00, 6s
6dd74de411 Another task : after a1, 6s
6dd74de412 section Another
6dd74de413 Task in sec : 06, 3s
6dd74de414 another task : 3s
6dd74de415 `,
6dd74de416 {}
6dd74de417 );
6dd74de418 });
6dd74de419
6dd74de420 it('should render a gantt diagram with tick is 15 minutes', () => {
6dd74de421 imgSnapshotTest(
6dd74de422 `
6dd74de423 gantt
6dd74de424 title A Gantt Diagram
6dd74de425 dateFormat YYYY-MM-DD
6dd74de426 axisFormat %H:%M
6dd74de427 tickInterval 15minute
6dd74de428 excludes weekends
6dd74de429
6dd74de430 section Section
6dd74de431 A task : a1, 2022-10-03, 6h
6dd74de432 Another task : after a1, 6h
6dd74de433 section Another
6dd74de434 Task in sec : 2022-10-03, 3h
6dd74de435 another task : 3h
6dd74de436 `,
6dd74de437 {}
6dd74de438 );
6dd74de439 });
6dd74de440
6dd74de441 it('should render a gantt diagram with tick is 6 hours', () => {
6dd74de442 imgSnapshotTest(
6dd74de443 `
6dd74de444 gantt
6dd74de445 title A Gantt Diagram
6dd74de446 dateFormat YYYY-MM-DD
6dd74de447 axisFormat %d %H:%M
6dd74de448 tickInterval 6hour
6dd74de449 excludes weekends
6dd74de450
6dd74de451 section Section
6dd74de452 A task : a1, 2022-10-03, 1d
6dd74de453 Another task : after a1, 2d
6dd74de454 section Another
6dd74de455 Task in sec : 2022-10-04, 2d
6dd74de456 another task : 2d
6dd74de457 `,
6dd74de458 {}
6dd74de459 );
6dd74de460 });
6dd74de461
6dd74de462 it('should render a gantt diagram with tick is 1 day', () => {
6dd74de463 imgSnapshotTest(
6dd74de464 `
6dd74de465 gantt
6dd74de466 title A Gantt Diagram
6dd74de467 dateFormat YYYY-MM-DD
6dd74de468 axisFormat %m-%d
6dd74de469 tickInterval 1day
6dd74de470 excludes weekends
6dd74de471
6dd74de472 section Section
6dd74de473 A task : a1, 2022-10-01, 30d
6dd74de474 Another task : after a1, 20d
6dd74de475 section Another
6dd74de476 Task in sec : 2022-10-20, 12d
6dd74de477 another task : 24d
6dd74de478 `,
6dd74de479 {}
6dd74de480 );
6dd74de481 });
6dd74de482
6dd74de483 it('should render a gantt diagram with tick is 1 week', () => {
6dd74de484 imgSnapshotTest(
6dd74de485 `
6dd74de486 gantt
6dd74de487 title A Gantt Diagram
6dd74de488 dateFormat YYYY-MM-DD
6dd74de489 axisFormat %m-%d
6dd74de490 tickInterval 1week
6dd74de491 excludes weekends
6dd74de492
6dd74de493 section Section
6dd74de494 A task : a1, 2022-10-01, 30d
6dd74de495 Another task : after a1, 20d
6dd74de496 section Another
6dd74de497 Task in sec : 2022-10-20, 12d
6dd74de498 another task : 24d
6dd74de499 `,
6dd74de500 {}
6dd74de501 );
6dd74de502 });
6dd74de503
6dd74de504 it('should render a gantt diagram with tick is 1 week, with the day starting on monday', () => {
6dd74de505 imgSnapshotTest(
6dd74de506 `
6dd74de507 gantt
6dd74de508 title A Gantt Diagram
6dd74de509 dateFormat YYYY-MM-DD
6dd74de510 axisFormat %m-%d
6dd74de511 tickInterval 1week
6dd74de512 weekday monday
6dd74de513 excludes weekends
6dd74de514
6dd74de515 section Section
6dd74de516 A task : a1, 2022-10-01, 30d
6dd74de517 Another task : after a1, 20d
6dd74de518 section Another
6dd74de519 Task in sec : 2022-10-20, 12d
6dd74de520 another task : 24d
6dd74de521 `,
6dd74de522 {}
6dd74de523 );
6dd74de524 });
6dd74de525
6dd74de526 it('should render a gantt diagram with tick is 1 month', () => {
6dd74de527 imgSnapshotTest(
6dd74de528 `
6dd74de529 gantt
6dd74de530 title A Gantt Diagram
6dd74de531 dateFormat YYYY-MM-DD
6dd74de532 axisFormat %m-%d
6dd74de533 tickInterval 1month
6dd74de534 excludes weekends
6dd74de535
6dd74de536 section Section
6dd74de537 A task : a1, 2022-10-01, 30d
6dd74de538 Another task : after a1, 20d
6dd74de539 section Another
6dd74de540 Task in sec : 2022-10-20, 12d
6dd74de541 another task : 24d
6dd74de542 `,
6dd74de543 {}
6dd74de544 );
6dd74de545 });
6dd74de546
6dd74de547 it('should render a gantt diagram with tick is 1 day and topAxis is true', () => {
6dd74de548 imgSnapshotTest(
6dd74de549 `
6dd74de550 gantt
6dd74de551 title A Gantt Diagram
6dd74de552 dateFormat YYYY-MM-DD
6dd74de553 axisFormat %m-%d
6dd74de554 tickInterval 1day
6dd74de555 excludes weekends
6dd74de556
6dd74de557 section Section
6dd74de558 A task : a1, 2022-10-01, 30d
6dd74de559 Another task : after a1, 20d
6dd74de560 section Another
6dd74de561 Task in sec : 2022-10-20, 12d
6dd74de562 another task : 24d
6dd74de563 `,
6dd74de564 { gantt: { topAxis: true } }
6dd74de565 );
6dd74de566 });
6dd74de567
6dd74de568 it('should render only the day when using dateFormat D', () => {
6dd74de569 imgSnapshotTest(
6dd74de570 `
6dd74de571 gantt
6dd74de572 title Test
6dd74de573 dateFormat D
6dd74de574 A :a, 1, 1d
6dd74de575 `,
6dd74de576 {}
6dd74de577 );
6dd74de578 });
6dd74de579
6dd74de580 // TODO: fix it
6dd74de581 //
6dd74de582 // This test is skipped deliberately
6dd74de583 // because it fails and blocks our development pipeline
6dd74de584 // It was added as an attempt to fix gantt performance issues
6dd74de585 //
6dd74de586 // https://github.com/mermaid-js/mermaid/issues/3274
6dd74de587 //
6dd74de588 it.skip('should render a gantt diagram with very large intervals, skipping excludes if interval > 5 years', () => {
6dd74de589 imgSnapshotTest(
6dd74de590 `gantt
6dd74de591 title A long Gantt Diagram
6dd74de592 dateFormat YYYY-MM-DD
6dd74de593 axisFormat %m-%d
6dd74de594 tickInterval 1day
6dd74de595 excludes weekends
6dd74de596 section Section
6dd74de597 A task : a1, 9999-10-01, 30d
6dd74de598 Another task : after a1, 20d
6dd74de599 section Another
6dd74de600 Task in sec : 2022-10-20, 12d
6dd74de601 another task : 24d
6dd74de602 `
6dd74de603 );
6dd74de604 });
6dd74de605 it('should render a gantt diagram excluding friday and saturday', () => {
6dd74de606 imgSnapshotTest(
6dd74de607 `gantt
6dd74de608 title A Gantt Diagram
6dd74de609 dateFormat YYYY-MM-DD
6dd74de610 excludes weekends
6dd74de611 weekend friday
6dd74de612 section Section1
6dd74de613 A task :a1, 2024-02-28, 10d`
6dd74de614 );
6dd74de615 });
6dd74de616 it('should render a gantt diagram excluding saturday and sunday', () => {
6dd74de617 imgSnapshotTest(
6dd74de618 `gantt
6dd74de619 title A Gantt Diagram
6dd74de620 dateFormat YYYY-MM-DD
6dd74de621 excludes weekends
6dd74de622 weekend saturday
6dd74de623 section Section1
6dd74de624 A task :a1, 2024-02-28, 10d`
6dd74de625 );
6dd74de626 });
6dd74de627 it('should render when compact is true', () => {
6dd74de628 imgSnapshotTest(
6dd74de629 `
6dd74de630 ---
6dd74de631 displayMode: compact
6dd74de632 ---
6dd74de633 gantt
6dd74de634 title GANTT compact
6dd74de635 dateFormat HH:mm:ss
6dd74de636 axisFormat %Hh%M
6dd74de637
6dd74de638 section DB Clean
6dd74de639 Clean: 12:00:00, 10m
6dd74de640 Clean: 12:30:00, 12m
6dd74de641 Clean: 13:00:00, 8m
6dd74de642 Clean: 13:30:00, 9m
6dd74de643 Clean: 14:00:00, 13m
6dd74de644 Clean: 14:30:00, 10m
6dd74de645 Clean: 15:00:00, 11m
6dd74de646
6dd74de647 section Sessions
6dd74de648 A: 12:00:00, 63m
6dd74de649 B: 12:30:00, 12m
6dd74de650 C: 13:05:00, 12m
6dd74de651 D: 13:06:00, 33m
6dd74de652 E: 13:15:00, 55m
6dd74de653 F: 13:20:00, 12m
6dd74de654 G: 13:32:00, 18m
6dd74de655 H: 13:50:00, 20m
6dd74de656 I: 14:10:00, 10m
6dd74de657 `,
6dd74de658 {}
6dd74de659 );
6dd74de660 });
6dd74de661
6dd74de662 it('should render a gantt diagram excluding a specific date in YYYY-MM-DD HH:mm:ss format', () => {
6dd74de663 imgSnapshotTest(
6dd74de664 `
6dd74de665 gantt
6dd74de666 dateFormat YYYY-MM-DD HH:mm:ss
6dd74de667 excludes 2025-07-07
6dd74de668 section Section
6dd74de669 A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
6dd74de670 Another task:after a1, 20h
6dd74de671 `,
6dd74de672 {}
6dd74de673 );
6dd74de674 });
6dd74de675
6dd74de676 it('should render a gantt diagram excluding saturday and sunday in YYYY-MM-DD HH:mm:ss format', () => {
6dd74de677 imgSnapshotTest(
6dd74de678 `
6dd74de679 gantt
6dd74de680 dateFormat YYYY-MM-DD HH:mm:ss
6dd74de681 excludes weekends
6dd74de682 weekend saturday
6dd74de683 section Section
6dd74de684 A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
6dd74de685 Another task:after a1, 20h
6dd74de686 `,
6dd74de687 {}
6dd74de688 );
6dd74de689 });
6dd74de690 it('should render a gantt diagram excluding friday and saturday in YYYY-MM-DD HH:mm:ss format', () => {
6dd74de691 imgSnapshotTest(
6dd74de692 `
6dd74de693 gantt
6dd74de694 dateFormat YYYY-MM-DD HH:mm:ss
6dd74de695 excludes weekends
6dd74de696 weekend friday
6dd74de697 section Section
6dd74de698 A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
6dd74de699 Another task:after a1, 20h
6dd74de700 `,
6dd74de701 {}
6dd74de702 );
6dd74de703 });
6dd74de704
6dd74de705 it("should render when there's a semicolon in the title", () => {
6dd74de706 imgSnapshotTest(
6dd74de707 `
6dd74de708 gantt
6dd74de709 title ;Gantt With a Semicolon in the Title
6dd74de710 dateFormat YYYY-MM-DD
6dd74de711 section Section
6dd74de712 A task :a1, 2014-01-01, 30d
6dd74de713 Another task :after a1 , 20d
6dd74de714 section Another
6dd74de715 Task in sec :2014-01-12 , 12d
6dd74de716 another task : 24d
6dd74de717 `,
6dd74de718 {}
6dd74de719 );
6dd74de720 });
6dd74de721
6dd74de722 it("should render when there's a semicolon in a section is true", () => {
6dd74de723 imgSnapshotTest(
6dd74de724 `
6dd74de725 gantt
6dd74de726 title Gantt Digram
6dd74de727 dateFormat YYYY-MM-DD
6dd74de728 section ;Section With a Semicolon
6dd74de729 A task :a1, 2014-01-01, 30d
6dd74de730 Another task :after a1 , 20d
6dd74de731 section Another
6dd74de732 Task in sec :2014-01-12 , 12d
6dd74de733 another task : 24d
6dd74de734 `,
6dd74de735 {}
6dd74de736 );
6dd74de737 });
6dd74de738
6dd74de739 it("should render when there's a semicolon in the task data", () => {
6dd74de740 imgSnapshotTest(
6dd74de741 `
6dd74de742 gantt
6dd74de743 title Gantt Digram
6dd74de744 dateFormat YYYY-MM-DD
6dd74de745 section Section
6dd74de746 ;A task with a semicolon :a1, 2014-01-01, 30d
6dd74de747 Another task :after a1 , 20d
6dd74de748 section Another
6dd74de749 Task in sec :2014-01-12 , 12d
6dd74de750 another task : 24d
6dd74de751 `,
6dd74de752 {}
6dd74de753 );
6dd74de754 });
6dd74de755
6dd74de756 it("should render when there's a hashtag in the title", () => {
6dd74de757 imgSnapshotTest(
6dd74de758 `
6dd74de759 gantt
6dd74de760 title #Gantt With a Hashtag in the Title
6dd74de761 dateFormat YYYY-MM-DD
6dd74de762 section Section
6dd74de763 A task :a1, 2014-01-01, 30d
6dd74de764 Another task :after a1 , 20d
6dd74de765 section Another
6dd74de766 Task in sec :2014-01-12 , 12d
6dd74de767 another task : 24d
6dd74de768 `,
6dd74de769 {}
6dd74de770 );
6dd74de771 });
6dd74de772
6dd74de773 it("should render when there's a hashtag in a section is true", () => {
6dd74de774 imgSnapshotTest(
6dd74de775 `
6dd74de776 gantt
6dd74de777 title Gantt Digram
6dd74de778 dateFormat YYYY-MM-DD
6dd74de779 section #Section With a Hashtag
6dd74de780 A task :a1, 2014-01-01, 30d
6dd74de781 Another task :after a1 , 20d
6dd74de782 section Another
6dd74de783 Task in sec :2014-01-12 , 12d
6dd74de784 another task : 24d
6dd74de785 `,
6dd74de786 {}
6dd74de787 );
6dd74de788 });
6dd74de789
6dd74de790 it("should render when there's a hashtag in the task data", () => {
6dd74de791 imgSnapshotTest(
6dd74de792 `
6dd74de793 gantt
6dd74de794 title Gantt Digram
6dd74de795 dateFormat YYYY-MM-DD
6dd74de796 section Section
6dd74de797 #A task with a hashtag :a1, 2014-01-01, 30d
6dd74de798 Another task :after a1 , 20d
6dd74de799 section Another
6dd74de800 Task in sec :2014-01-12 , 12d
6dd74de801 another task : 24d
6dd74de802 `,
6dd74de803 {}
6dd74de804 );
6dd74de805 });
6dd74de806 it('should handle numeric timestamps with dateFormat x', () => {
6dd74de807 imgSnapshotTest(
6dd74de808 `
6dd74de809 gantt
6dd74de810 title Process time profile (ms)
6dd74de811 dateFormat x
6dd74de812 axisFormat %L
6dd74de813 tickInterval 250millisecond
6dd74de814
6dd74de815 section Pipeline
6dd74de816 Parse JSON p1: 000, 120
6dd74de817 `,
6dd74de818 {}
6dd74de819 );
6dd74de820 });
6dd74de821 it('should handle numeric timestamps with dateFormat X', () => {
6dd74de822 imgSnapshotTest(
6dd74de823 `
6dd74de824 gantt
6dd74de825 title Process time profile (ms)
6dd74de826 dateFormat X
6dd74de827 axisFormat %L
6dd74de828 tickInterval 250millisecond
6dd74de829
6dd74de830 section Pipeline
6dd74de831 Parse JSON p1: 000, 120
6dd74de832 `,
6dd74de833 {}
6dd74de834 );
6dd74de835 });
6dd74de836 it('should handle seconds-only format with tickInterval (issue #5496)', () => {
6dd74de837 imgSnapshotTest(
6dd74de838 `
6dd74de839 gantt
6dd74de840 tickInterval 1second
6dd74de841 dateFormat ss
6dd74de842 axisFormat %s
6dd74de843
6dd74de844 section Network Request
6dd74de845 RTT : rtt, 0, 20
6dd74de846 `,
6dd74de847 {}
6dd74de848 );
6dd74de849 });
6dd74de850 it('should handle dates with year typo like 202 instead of 2024 (issue #5496)', () => {
6dd74de851 imgSnapshotTest(
6dd74de852 `
6dd74de853 gantt
6dd74de854 title Schedule
6dd74de855 dateFormat YYYY-MM-DD
6dd74de856 tickInterval 1week
6dd74de857 axisFormat %m-%d
6dd74de858
6dd74de859 section Vacation
6dd74de860 London : 2024-12-01, 7d
6dd74de861 London : 202-12-01, 7d
6dd74de862 `,
6dd74de863 {}
6dd74de864 );
6dd74de865 });
6dd74de866});