File tree 3 files changed +24
-19
lines changed
3 files changed +24
-19
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' mermaid ' : patch
3
+ ---
4
+
5
+ ` mermaidAPI.getDiagramFromText() ` now returns a new different db for each state diagram
Original file line number Diff line number Diff line change @@ -30,12 +30,15 @@ export class StateDb {
30
30
#START_TYPE = 'start' ;
31
31
#END_NODE = this . #START_NODE;
32
32
#END_TYPE = 'end' ;
33
-
34
33
#COLOR_KEYWORD = 'color' ;
35
34
#FILL_KEYWORD = 'fill' ;
36
35
#BG_FILL = 'bgFill' ;
37
36
#STYLECLASS_SEP = ',' ;
38
37
38
+ constructor ( ) {
39
+ this . clear ( ) ;
40
+ }
41
+
39
42
/**
40
43
* Returns a new list of classes.
41
44
* In the future, this can be replaced with a class common to all diagrams.
@@ -54,10 +57,6 @@ export class StateDb {
54
57
#rootDoc = [ ] ;
55
58
#classes = this . #newClassesList( ) ; // style classes defined by a classDef
56
59
57
- constructor ( ) {
58
- this . clear ( ) ;
59
- }
60
-
61
60
// --------------------------------------
62
61
63
62
#newDoc = ( ) => {
Original file line number Diff line number Diff line change @@ -838,27 +838,28 @@ graph TD;A--x|text including URL space|B;`)
838
838
it ( 'should not modify db when rendering different diagrams' , async ( ) => {
839
839
const classDiagram1 = await mermaidAPI . getDiagramFromText (
840
840
`stateDiagram
841
- direction LR
842
- [*] --> Still
843
- Still --> [*]
844
- Still --> Moving
845
- Moving --> Still
846
- Moving --> Crash
847
- Crash --> [*]`
841
+ direction LR
842
+ [*] --> Still
843
+ Still --> [*]
844
+ Still --> Moving
845
+ Moving --> Still
846
+ Moving --> Crash
847
+ Crash --> [*]`
848
848
) ;
849
849
const classDiagram2 = await mermaidAPI . getDiagramFromText (
850
850
`stateDiagram
851
- [*] --> Still
852
- Still --> [*]
853
- Still --> Moving
854
- Moving --> Still
855
- Moving --> Crash
856
- Crash --> [*]`
851
+ direction TB
852
+ [*] --> Still
853
+ Still --> [*]
854
+ Still --> Moving
855
+ Moving --> Still
856
+ Moving --> Crash
857
+ Crash --> [*]`
857
858
) ;
858
859
expect ( classDiagram1 . db ) . not . toBe ( classDiagram2 . db ) ;
859
860
assert ( classDiagram1 . db instanceof StateDb ) ;
860
861
assert ( classDiagram2 . db instanceof StateDb ) ;
861
- expect ( classDiagram2 . db . getDirection ( ) ) . not . toEqual ( classDiagram2 . db . getDirection ( ) ) ;
862
+ expect ( classDiagram1 . db . getDirection ( ) ) . not . toEqual ( classDiagram2 . db . getDirection ( ) ) ;
862
863
} ) ;
863
864
} ) ;
864
865
You can’t perform that action at this time.
0 commit comments