25.4 KB1046 lines
Blame
1import { imgSnapshotTest } from '../../helpers/util.ts';
2describe('Class diagram V3', () => {
3 it('0: should render a simple class diagram', () => {
4 imgSnapshotTest(
5 `
6 classDiagram
7
8 classA -- classB : Inheritance
9 classA -- classC : link
10 classC -- classD : link
11 classB -- classD
12
13 `,
14 { logLevel: 1, htmlLabels: true }
15 );
16 });
17
18 it('1: should render a simple class diagram', () => {
19 imgSnapshotTest(
20 `
21 classDiagram
22 Class01 <|-- AveryLongClass : Cool
23 &lt;&lt;interface&gt;&gt; Class01
24 Class03 *-- Class04
25 Class05 o-- Class06
26 Class07 .. Class08
27 Class09 --> C2 : Where am i?
28 Class09 --* C3
29 Class09 --|> Class07
30 Class12 <|.. Class08
31 Class11 ..>Class12
32 Class07 : equals()
33 Class07 : Object[] elementData
34 Class01 : size()
35 Class01 : int chimp
36 Class01 : int gorilla
37 Class01 : -int privateChimp
38 Class01 : +int publicGorilla
39 Class01 : #int protectedMarmoset
40 Class08 <--> C2: Cool label
41 class Class10 {
42 &lt;&lt;service&gt;&gt;
43 int id
44 test()
45 }
46 `,
47 { logLevel: 1, htmlLabels: true }
48 );
49 });
50
51 it('1.1: should render a simple class diagram without htmlLabels', () => {
52 imgSnapshotTest(
53 `
54 classDiagram
55 Class01 <|-- AveryLongClass : Cool
56 &lt;&lt;interface&gt;&gt; Class01
57 Class03 *-- Class04
58 Class05 o-- Class06
59 Class07 .. Class08
60 Class09 --> C2 : Where am i?
61 Class09 --* C3
62 Class09 --|> Class07
63 Class12 <|.. Class08
64 Class11 ..>Class12
65 Class07 : equals()
66 Class07 : Object[] elementData
67 Class01 : size()
68 Class01 : int chimp
69 Class01 : int gorilla
70 Class01 : -int privateChimp
71 Class01 : +int publicGorilla
72 Class01 : #int protectedMarmoset
73 Class08 <--> C2: Cool label
74 class Class10 {
75 &lt;&lt;service&gt;&gt;
76 int id
77 test()
78 }
79 `,
80 { logLevel: 1, htmlLabels: false }
81 );
82 });
83
84 it('2: should render a simple class diagrams with cardinality', () => {
85 imgSnapshotTest(
86 `
87 classDiagram
88 Class01 "1" <|--|> "*" AveryLongClass : Cool
89 &lt;&lt;interface&gt;&gt; Class01
90 Class03 "1" *-- "*" Class04
91 Class05 "1" o-- "many" Class06
92 Class07 "1" .. "*" Class08
93 Class09 "1" --> "*" C2 : Where am i?
94 Class09 "*" --* "*" C3
95 Class09 "1" --|> "1" Class07
96 Class07 : equals()
97 Class07 : Object[] elementData
98 Class01 : size()
99 Class01 : int chimp
100 Class01 : int gorilla
101 Class08 "1" <--> "*" C2: Cool label
102 class Class10 {
103 &lt;&lt;service&gt;&gt;
104 int id
105 test()
106 }
107 `,
108 { logLevel: 1, htmlLabels: true }
109 );
110 });
111
112 it('2.1: should render a simple class diagrams with cardinality without htmlLabels', () => {
113 imgSnapshotTest(
114 `
115 classDiagram
116 Class01 "1" <|--|> "*" AveryLongClass : Cool
117 &lt;&lt;interface&gt;&gt; Class01
118 Class03 "1" *-- "*" Class04
119 Class05 "1" o-- "many" Class06
120 Class07 "1" .. "*" Class08
121 Class09 "1" --> "*" C2 : Where am i?
122 Class09 "*" --* "*" C3
123 Class09 "1" --|> "1" Class07
124 Class07 : equals()
125 Class07 : Object[] elementData
126 Class01 : size()
127 Class01 : int chimp
128 Class01 : int gorilla
129 Class08 "1" <--> "*" C2: Cool label
130 class Class10 {
131 &lt;&lt;service&gt;&gt;
132 int id
133 test()
134 }
135 `,
136 { logLevel: 1, htmlLabels: false }
137 );
138 });
139
140 it('2.2 should render a simple class diagram with different visibilities', () => {
141 imgSnapshotTest(
142 `
143 classDiagram
144 Class01 <|-- AveryLongClass : Cool
145 &lt;&lt;interface&gt;&gt; Class01
146 Class01 : -privateMethod()
147 Class01 : +publicMethod()
148 Class01 : #protectedMethod()
149 Class01 : -int privateChimp
150 Class01 : +int publicGorilla
151 Class01 : #int protectedMarmoset
152 `,
153 { logLevel: 1, htmlLabels: true }
154 );
155 });
156 it('2.3 should render a simple class diagram with different visibilities without htmlLabels', () => {
157 imgSnapshotTest(
158 `
159 classDiagram
160 Class01 <|-- AveryLongClass : Cool
161 &lt;&lt;interface&gt;&gt; Class01
162 Class01 : -privateMethod()
163 Class01 : +publicMethod()
164 Class01 : #protectedMethod()
165 Class01 : -int privateChimp
166 Class01 : +int publicGorilla
167 Class01 : #int protectedMarmoset
168 `,
169 { logLevel: 1, htmlLabels: false }
170 );
171 });
172
173 it('3: should render multiple class diagrams', () => {
174 imgSnapshotTest(
175 [
176 `
177 classDiagram
178 Class01 "1" <|--|> "*" AveryLongClass : Cool
179 &lt;&lt;interface&gt;&gt; Class01
180 Class03 "1" *-- "*" Class04
181 Class05 "1" o-- "many" Class06
182 Class07 "1" .. "*" Class08
183 Class09 "1" --> "*" C2 : Where am i?
184 Class09 "*" --* "*" C3
185 Class09 "1" --|> "1" Class07
186 Class07 : equals()
187 Class07 : Object[] elementData
188 Class01 : size()
189 Class01 : int chimp
190 Class01 : int gorilla
191 Class08 "1" <--> "*" C2: Cool label
192 class Class10 {
193 &lt;&lt;service&gt;&gt;
194 int id
195 test()
196 }
197 `,
198 `
199 classDiagram
200 Class01 "1" <|--|> "*" AveryLongClass : Cool
201 &lt;&lt;interface&gt;&gt; Class01
202 Class03 "1" *-- "*" Class04
203 Class05 "1" o-- "many" Class06
204 Class07 "1" .. "*" Class08
205 Class09 "1" --> "*" C2 : Where am i?
206 Class09 "*" --* "*" C3
207 Class09 "1" --|> "1" Class07
208 Class07 : equals()
209 Class07 : Object[] elementData
210 Class01 : size()
211 Class01 : int chimp
212 Class01 : int gorilla
213 Class08 "1" <--> "*" C2: Cool label
214 class Class10 {
215 &lt;&lt;service&gt;&gt;
216 int id
217 test()
218 }
219 `,
220 ],
221 { logLevel: 1, htmlLabels: true }
222 );
223 });
224
225 it('4: should render a simple class diagram with comments', () => {
226 imgSnapshotTest(
227 `
228 classDiagram
229 %% this is a comment
230 Class01 <|-- AveryLongClass : Cool
231 &lt;&lt;interface&gt;&gt; Class01
232 Class03 *-- Class04
233 Class05 o-- Class06
234 Class07 .. Class08
235 Class09 --> C2 : Where am i?
236 Class09 --* C3
237 Class09 --|> Class07
238 Class07 : equals()
239 Class07 : Object[] elementData
240 Class01 : size()
241 Class01 : int chimp
242 Class01 : int gorilla
243 Class08 <--> C2: Cool label
244 class Class10 {
245 &lt;&lt;service&gt;&gt;
246 int id
247 test()
248 }
249 `,
250 { logLevel: 1, htmlLabels: true }
251 );
252 });
253
254 it('5: should render a simple class diagram with abstract method', () => {
255 imgSnapshotTest(
256 `
257 classDiagram
258 Class01 <|-- AveryLongClass : Cool
259 Class01 : someMethod()*
260 `,
261 { logLevel: 1, htmlLabels: true }
262 );
263 });
264
265 it('5.1: should render a simple class diagram with abstract method without htmlLabels', () => {
266 imgSnapshotTest(
267 `
268 classDiagram
269 Class01 <|-- AveryLongClass : Cool
270 Class01 : someMethod()*
271 `,
272 { logLevel: 1, htmlLabels: false }
273 );
274 });
275
276 it('6: should render a simple class diagram with static method', () => {
277 imgSnapshotTest(
278 `
279 classDiagram
280 Class01 <|-- AveryLongClass : Cool
281 Class01 : someMethod()$
282 `,
283 { logLevel: 1, htmlLabels: true }
284 );
285 });
286
287 it('6.1: should render a simple class diagram with static method without htmlLabels', () => {
288 imgSnapshotTest(
289 `
290 classDiagram
291 Class01 <|-- AveryLongClass : Cool
292 Class01 : someMethod()$
293 `,
294 { logLevel: 1, htmlLabels: false }
295 );
296 });
297
298 it('7: should render a simple class diagram with Generic class', () => {
299 imgSnapshotTest(
300 `
301 classDiagram
302 class Class01~T~
303 Class01 : size()
304 Class01 : int chimp
305 Class01 : int gorilla
306 Class08 <--> C2: Cool label
307 class Class10~T~ {
308 &lt;&lt;service&gt;&gt;
309 int id
310 test()
311 }
312 `,
313 { logLevel: 1, htmlLabels: true }
314 );
315 });
316
317 it('7.1: should render a simple class diagram with Generic class without htmlLabels', () => {
318 imgSnapshotTest(
319 `
320 classDiagram
321 class Class01~T~
322 Class01 : size()
323 Class01 : int chimp
324 Class01 : int gorilla
325 Class08 <--> C2: Cool label
326 class Class10~T~ {
327 &lt;&lt;service&gt;&gt;
328 int id
329 test()
330 }
331 `,
332 { logLevel: 1, htmlLabels: false }
333 );
334 });
335
336 it('8: should render a simple class diagram with Generic class and relations', () => {
337 imgSnapshotTest(
338 `
339 classDiagram
340 Class01~T~ <|-- AveryLongClass : Cool
341 Class03~T~ *-- Class04~T~
342 Class01 : size()
343 Class01 : int chimp
344 Class01 : int gorilla
345 Class08 <--> C2: Cool label
346 class Class10~T~ {
347 &lt;&lt;service&gt;&gt;
348 int id
349 test()
350 }
351 `,
352 { logLevel: 1, htmlLabels: true }
353 );
354 });
355
356 it('9: should render a simple class diagram with clickable link', () => {
357 imgSnapshotTest(
358 `
359 classDiagram
360 Class01~T~ <|-- AveryLongClass : Cool
361 Class03~T~ *-- Class04~T~
362 Class01 : size()
363 Class01 : int chimp
364 Class01 : int gorilla
365 Class08 <--> C2: Cool label
366 class Class10~T~ {
367 &lt;&lt;service&gt;&gt;
368 int id
369 test()
370 }
371 link Class01 "google.com" "A Tooltip"
372 `,
373 { logLevel: 1, htmlLabels: true }
374 );
375 });
376
377 it('10: should render a simple class diagram with clickable callback', () => {
378 imgSnapshotTest(
379 `
380 classDiagram
381 Class01~T~ <|-- AveryLongClass : Cool
382 Class03~T~ *-- Class04~T~
383 Class01 : size()
384 Class01 : int chimp
385 Class01 : int gorilla
386 Class08 <--> C2: Cool label
387 class Class10~T~ {
388 &lt;&lt;service&gt;&gt;
389 int id
390 test()
391 }
392 callback Class01 "functionCall" "A Tooltip"
393 `,
394 { logLevel: 1, htmlLabels: true }
395 );
396 });
397
398 it('11: should render a simple class diagram with return type on method', () => {
399 imgSnapshotTest(
400 `
401 classDiagram
402 class Class10~T~ {
403 int[] id
404 test(int[] ids) bool
405 testArray() bool[]
406 }
407 `,
408 { logLevel: 1, htmlLabels: true }
409 );
410 });
411
412 it('11.1: should render a simple class diagram with return type on method without htmlLabels', () => {
413 imgSnapshotTest(
414 `
415 classDiagram
416 class Class10~T~ {
417 int[] id
418 test(int[] ids) bool
419 testArray() bool[]
420 }
421 `,
422 { logLevel: 1, htmlLabels: false }
423 );
424 });
425
426 it('12: should render a simple class diagram with generic types', () => {
427 imgSnapshotTest(
428 `
429 classDiagram
430 class Class10~T~ {
431 int[] id
432 List~int~ ids
433 test(List~int~ ids) List~bool~
434 testArray() bool[]
435 }
436 `,
437 { logLevel: 1, htmlLabels: true }
438 );
439 });
440
441 it('12.1: should render a simple class diagram with generic types without htmlLabels', () => {
442 imgSnapshotTest(
443 `
444 classDiagram
445 class Class10~T~ {
446 int[] id
447 List~int~ ids
448 test(List~int~ ids) List~bool~
449 testArray() bool[]
450 }
451 `,
452 { logLevel: 1, htmlLabels: false }
453 );
454 });
455
456 it('13: should render a simple class diagram with css classes applied', () => {
457 imgSnapshotTest(
458 `
459 classDiagram
460 class Class10 {
461 int[] id
462 List~int~ ids
463 test(List~int~ ids) List~bool~
464 testArray() bool[]
465 }
466
467 cssClass "Class10" exClass2
468 `,
469 { logLevel: 1, htmlLabels: true }
470 );
471 });
472
473 it('14: should render a simple class diagram with css classes applied directly', () => {
474 imgSnapshotTest(
475 `
476 classDiagram
477 class Class10:::exClass2 {
478 int[] id
479 List~int~ ids
480 test(List~int~ ids) List~bool~
481 testArray() bool[]
482 }
483 `,
484 { logLevel: 1, htmlLabels: true }
485 );
486 });
487
488 it('15: should render a simple class diagram with css classes applied two multiple classes', () => {
489 imgSnapshotTest(
490 `
491 classDiagram
492 class Class10
493 class Class20
494
495 cssClass "Class10, class20" exClass2
496 `,
497 { logLevel: 1, htmlLabels: true }
498 );
499 });
500
501 it('16a: should render a simple class diagram with static field', () => {
502 imgSnapshotTest(
503 `
504 classDiagram
505 class Foo {
506 +String bar$
507 }
508 `,
509 { logLevel: 1, htmlLabels: true }
510 );
511 });
512
513 it('16b: should handle the direction statement with TB', () => {
514 imgSnapshotTest(
515 `
516 classDiagram
517 direction TB
518 class Student {
519 -idCard : IdCard
520 }
521 class IdCard{
522 -id : int
523 -name : string
524 }
525 class Bike{
526 -id : int
527 -name : string
528 }
529 Student "1" --o "1" IdCard : carries
530 Student "1" --o "1" Bike : rides
531
532 `,
533 { logLevel: 1, htmlLabels: true }
534 );
535 });
536 it('17a: should handle the direction statement with BT', () => {
537 imgSnapshotTest(
538 `
539 classDiagram
540 direction BT
541 class Student {
542 -idCard : IdCard
543 }
544 class IdCard{
545 -id : int
546 -name : string
547 }
548 class Bike{
549 -id : int
550 -name : string
551 }
552 Student "1" --o "1" IdCard : carries
553 Student "1" --o "1" Bike : rides
554
555 `,
556 { logLevel: 1, htmlLabels: true }
557 );
558 });
559 it('17b: should handle the direction statement with RL', () => {
560 imgSnapshotTest(
561 `
562 classDiagram
563 direction RL
564 class Student {
565 -idCard : IdCard
566 }
567 class IdCard{
568 -id : int
569 -name : string
570 }
571 class Bike{
572 -id : int
573 -name : string
574 }
575 Student "1" --o "1" IdCard : carries
576 Student "1" --o "1" Bike : rides
577
578 `,
579 { logLevel: 1, htmlLabels: true }
580 );
581 });
582
583 it('18a: should handle the direction statement with LR', () => {
584 imgSnapshotTest(
585 `
586 classDiagram
587 direction LR
588 class Student {
589 -idCard : IdCard
590 }
591 class IdCard{
592 -id : int
593 -name : string
594 }
595 class Bike{
596 -id : int
597 -name : string
598 }
599 Student "1" --o "1" IdCard : carries
600 Student "1" --o "1" Bike : rides
601
602 `,
603 { logLevel: 1, htmlLabels: true }
604 );
605 });
606
607 it('18b: should render a simple class diagram with notes', () => {
608 imgSnapshotTest(
609 `
610 classDiagram
611 note "I love this diagram!\nDo you love it?"
612 class Class10 {
613 int id
614 size()
615 }
616 note for Class10 "Cool class\nI said it's very cool class!"
617
618 `,
619 { logLevel: 1, htmlLabels: true }
620 );
621 });
622
623 it('1433: should render a simple class with a title', () => {
624 imgSnapshotTest(
625 `---
626title: simple class diagram
627---
628classDiagram
629class Class10
630`
631 );
632 });
633
634 it('should render a class with text label', () => {
635 imgSnapshotTest(
636 `classDiagram
637 class C1["Class 1 with text label"]
638 C1 --> C2`
639 );
640 });
641
642 it('should render two classes with text labels', () => {
643 imgSnapshotTest(
644 `classDiagram
645 class C1["Class 1 with text label"]
646 class C2["Class 2 with chars @?"]
647 C1 --> C2`
648 );
649 });
650 it('should render a class with a text label, members and annotation', () => {
651 imgSnapshotTest(
652 `classDiagram
653 class C1["Class 1 with text label"] {
654 &lt;&lt;interface&gt;&gt;
655 +member1
656 }
657 C1 --> C2`
658 );
659 });
660 it('should render multiple classes with same text labels', () => {
661 imgSnapshotTest(
662 `classDiagram
663class C1["Class with text label"]
664class C2["Class with text label"]
665class C3["Class with text label"]
666C1 --> C2
667C3 ..> C2
668 `
669 );
670 });
671 it('should render classes with different text labels', () => {
672 imgSnapshotTest(
673 `classDiagram
674class C1["OneWord"]
675class C2["With, Comma"]
676class C3["With (Brackets)"]
677class C4["With [Brackets]"]
678class C5["With {Brackets}"]
679class C7["With 1 number"]
680class C8["With . period..."]
681class C9["With - dash"]
682class C10["With _ underscore"]
683class C11["With ' single quote"]
684class C12["With ~!@#$%^&*()_+=-/?"]
685class C13["With Città foreign language"]
686 `
687 );
688 });
689
690 it('should render classLabel if class has already been defined earlier', () => {
691 imgSnapshotTest(
692 `classDiagram
693 Animal <|-- Duck
694 class Duck["Duck with text label"]
695`
696 );
697 });
698 it('should add classes namespaces', function () {
699 imgSnapshotTest(
700 `
701 classDiagram
702 namespace Namespace1 {
703 class C1
704 class C2
705 }
706 C1 --> C2
707 class C3
708 class C4
709 `
710 );
711 });
712 it('should add notes in namespaces', function () {
713 imgSnapshotTest(
714 `
715 classDiagram
716 note "This is a outer note"
717 note for C1 "This is a outer note for C1"
718 namespace Namespace1 {
719 note "This is a inner note"
720 note for C1 "This is a inner note for C1"
721 class C1
722 }
723 `
724 );
725 });
726 it('should render a simple class diagram with no members', () => {
727 imgSnapshotTest(
728 `
729 classDiagram
730 class Class10
731 `,
732 { logLevel: 1, htmlLabels: true }
733 );
734 });
735 it('should render a simple class diagram with no members if hideEmptyMembersBox is enabled', () => {
736 imgSnapshotTest(
737 `
738 classDiagram
739 class Class10
740 `,
741 { logLevel: 1, class: { htmlLabels: true, hideEmptyMembersBox: true } }
742 );
743 });
744 it('should render a simple class diagram with no attributes, only methods', () => {
745 imgSnapshotTest(
746 `
747 classDiagram
748 class Duck {
749 +swim()
750 +quack()
751 }
752 `
753 );
754 });
755 it('should render a simple class diagram with no methods, only attributes', () => {
756 imgSnapshotTest(
757 `
758 classDiagram
759 class Duck {
760 +String beakColor
761 +int age
762 +float weight
763 }
764 `
765 );
766 });
767 it('should render a simple class diagram with style definition', () => {
768 imgSnapshotTest(
769 `
770 classDiagram
771 class Class10
772 style Class10 fill:#f9f,stroke:#333,stroke-width:4px
773 `,
774 { logLevel: 1, htmlLabels: true }
775 );
776 });
777 it('should render a simple class diagram with style definition without htmlLabels', () => {
778 imgSnapshotTest(
779 `
780 classDiagram
781 class Class10
782 style Class10 fill:#f9f,stroke:#333,stroke-width:4px
783 `,
784 { logLevel: 1, htmlLabels: false }
785 );
786 });
787 it('should render a simple class diagram with classDef definitions', () => {
788 imgSnapshotTest(
789 `
790 classDiagram
791 class Class10
792 classDef pink fill:#f9f
793 classDef bold stroke:#333,stroke-width:6px,color:#fff
794 `,
795 { logLevel: 1, htmlLabels: true }
796 );
797 });
798 it('should render a simple class diagram with classDefs being applied', () => {
799 imgSnapshotTest(
800 `
801 classDiagram
802 class Class10:::pink
803 cssClass "Class10" bold
804 classDef pink fill:#f9f
805 classDef bold stroke:#333,stroke-width:6px,color:#fff
806 `,
807 { logLevel: 1, htmlLabels: true }
808 );
809 });
810 it('should render a simple class diagram with classDefs being applied without htmlLabels', () => {
811 imgSnapshotTest(
812 `
813 classDiagram
814 class Class10:::pink
815 cssClass "Class10" bold
816 classDef pink fill:#f9f
817 classDef bold stroke:#333,stroke-width:6px,color:#fff
818 `,
819 { logLevel: 1, htmlLabels: false }
820 );
821 });
822 it('should render a simple class diagram with markdown styling', () => {
823 imgSnapshotTest(
824 `
825 classDiagram
826 class Class10 {
827 +attribute *italic**
828 ~attribute **bold***
829 _italicmethod_()
830 __boldmethod__()
831 _+_swim_()a_
832 __+quack() test__
833 }
834 `,
835 { logLevel: 1, htmlLabels: true }
836 );
837 });
838 it('should render a simple class diagram with markdown styling without htmlLabels', () => {
839 imgSnapshotTest(
840 `
841 classDiagram
842 class Class10 {
843 +attribute *italic**
844 ~attribute **bold***
845 _italicmethod_()
846 __boldmethod__()
847 _+_swim_()a_
848 __+quack() test__
849 }
850 `,
851 { logLevel: 1, htmlLabels: false }
852 );
853 });
854 it('should render a simple class diagram with the handDrawn look', () => {
855 imgSnapshotTest(
856 `
857 classDiagram
858 class Class10
859 `,
860 { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
861 );
862 });
863 it('should render a simple class diagram with styles and the handDrawn look', () => {
864 imgSnapshotTest(
865 `
866 classDiagram
867 class Class10
868 style Class10 fill:#f9f,stroke:#333,stroke-width:4px,color:white
869 `,
870 { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
871 );
872 });
873 it('should render a simple class diagram with styles and the handDrawn look without htmlLabels', () => {
874 imgSnapshotTest(
875 `
876 classDiagram
877 class Class10
878 style Class10 fill:#f9f,stroke:#333,stroke-width:4px,color:white
879 `,
880 { logLevel: 1, htmlLabels: false, look: 'handDrawn' }
881 );
882 });
883 it('should render a full class diagram with the handDrawn look', () => {
884 imgSnapshotTest(
885 `
886 classDiagram
887 note "I love this diagram!\nDo you love it?"
888 Class01 <|-- AveryLongClass : Cool
889 &lt;&lt;interface&gt;&gt; Class01
890 Class03 "1" *-- "*" Class04
891 Class05 "1" o-- "many" Class06
892 Class07 "1" .. "*" Class08
893 Class09 "1" --> "*" C2 : Where am i?
894 Class09 "*" --* "*" C3
895 Class09 "1" --|> "1" Class07
896 Class12 <|.. Class08
897 Class11 ..>Class12
898 Class07 : equals()
899 Class07 : Object[] elementData
900 Class01 : size()
901 Class01 : int chimp
902 Class01 : int gorilla
903 Class01 : -int privateChimp
904 Class01 : +int publicGorilla
905 Class01 : #int protectedMarmoset
906 Class08 <--> C2: Cool label
907 class Class10 {
908 &lt;&lt;service&gt;&gt;
909 int id
910 test()
911 }
912 note for Class10 "Cool class\nI said it's very cool class!"
913 `,
914 { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
915 );
916 });
917 it('should render a simple class diagram with a custom theme', () => {
918 imgSnapshotTest(
919 `
920 %%{
921 init: {
922 'theme': 'base',
923 'themeVariables': {
924 'primaryColor': '#BB2528',
925 'primaryTextColor': '#fff',
926 'primaryBorderColor': '#7C0000',
927 'lineColor': '#F83d29',
928 'secondaryColor': '#006100',
929 'tertiaryColor': '#fff'
930 }
931 }
932 }%%
933 classDiagram
934 Class01 <|-- AveryLongClass : Cool
935 &lt;&lt;interface&gt;&gt; Class01
936 Class03 *-- Class04
937 Class05 o-- Class06
938 Class07 .. Class08
939 Class09 --> C2 : Where am i?
940 Class09 --* C3
941 Class09 --|> Class07
942 Class12 <|.. Class08
943 Class11 ..>Class12
944 Class07 : equals()
945 Class07 : Object[] elementData
946 Class01 : size()
947 Class01 : int chimp
948 Class01 : int gorilla
949 Class01 : -int privateChimp
950 Class01 : +int publicGorilla
951 Class01 : #int protectedMarmoset
952 Class08 <--> C2: Cool label
953 class Class10 {
954 &lt;&lt;service&gt;&gt;
955 int id
956 test()
957 }
958 `,
959 { logLevel: 1, htmlLabels: true }
960 );
961 });
962 it('should render a simple class diagram with a custom theme and the handDrawn look', () => {
963 imgSnapshotTest(
964 `
965 %%{
966 init: {
967 'theme': 'base',
968 'themeVariables': {
969 'primaryColor': '#BB2528',
970 'primaryTextColor': '#fff',
971 'primaryBorderColor': '#7C0000',
972 'lineColor': '#F83d29',
973 'secondaryColor': '#006100',
974 'tertiaryColor': '#fff'
975 }
976 }
977 }%%
978 classDiagram
979 Class01 <|-- AveryLongClass : Cool
980 &lt;&lt;interface&gt;&gt; Class01
981 Class03 *-- Class04
982 Class05 o-- Class06
983 Class07 .. Class08
984 Class09 --> C2 : Where am i?
985 Class09 --* C3
986 Class09 --|> Class07
987 Class12 <|.. Class08
988 Class11 ..>Class12
989 Class07 : equals()
990 Class07 : Object[] elementData
991 Class01 : size()
992 Class01 : int chimp
993 Class01 : int gorilla
994 Class01 : -int privateChimp
995 Class01 : +int publicGorilla
996 Class01 : #int protectedMarmoset
997 Class08 <--> C2: Cool label
998 class Class10 {
999 &lt;&lt;service&gt;&gt;
1000 int id
1001 test()
1002 }
1003 `,
1004 { logLevel: 1, htmlLabels: true, look: 'handDrawn' }
1005 );
1006 });
1007 it('should render a full class diagram using elk', () => {
1008 imgSnapshotTest(
1009 `
1010---
1011 config:
1012 layout: elk
1013---
1014 classDiagram
1015 note "I love this diagram!\nDo you love it?"
1016 Class01 <|-- AveryLongClass : Cool
1017 &lt;&lt;interface&gt;&gt; Class01
1018 Class03 "1" *-- "*" Class04
1019 Class05 "1" o-- "many" Class06
1020 Class07 "1" .. "*" Class08
1021 Class09 "1" --> "*" C2 : Where am i?
1022 Class09 "*" --* "*" C3
1023 Class09 "1" --|> "1" Class07
1024 Class12 <|.. Class08
1025 Class11 ..>Class12
1026 Class07 : equals()
1027 Class07 : Object[] elementData
1028 Class01 : size()
1029 Class01 : int chimp
1030 Class01 : int gorilla
1031 Class01 : -int privateChimp
1032 Class01 : +int publicGorilla
1033 Class01 : #int protectedMarmoset
1034 Class08 <--> C2: Cool label
1035 class Class10 {
1036 &lt;&lt;service&gt;&gt;
1037 int id
1038 test()
1039 }
1040 note for Class10 "Cool class\nI said it's very cool class!"
1041 `,
1042 { logLevel: 1, htmlLabels: true }
1043 );
1044 });
1045});
1046