diff --git a/.cspell/mermaid-terms.txt b/.cspell/mermaid-terms.txt index 3fa5eff2699..b64714e94e8 100644 --- a/.cspell/mermaid-terms.txt +++ b/.cspell/mermaid-terms.txt @@ -4,6 +4,7 @@ bmatrix braintree catmull compositTitleSize +deephistory doublecircle elems gantt diff --git a/cypress/integration/rendering/stateDiagram-v2.spec.js b/cypress/integration/rendering/stateDiagram-v2.spec.js index cb40aa8dc0d..83d857a53bf 100644 --- a/cypress/integration/rendering/stateDiagram-v2.spec.js +++ b/cypress/integration/rendering/stateDiagram-v2.spec.js @@ -330,6 +330,41 @@ describe('State diagram', () => { } ); }); + it('v2 it should be possible to use a (deep) history node', () => { + imgSnapshotTest( + ` + stateDiagram-v2 + state "A" as A { + state "B" as B + state "C" as C + state A_History [[history]] + + B --> C + C --> B + } + state "D" as D { + state "E" as E { + state "F" as F + state "G" as G + + F --> G + G --> F + } + state "I" as I + state D_History [[deephistory]] + + E --> I + I --> E + } + + G --> A_History + A --> D_History + `, + { + logLevel: 0, + } + ); + }); it('v2 A compound state should be able to link to itself', () => { imgSnapshotTest( ` diff --git a/demos/state.html b/demos/state.html index aaa8e0aa990..9cdcbf720f2 100644 --- a/demos/state.html +++ b/demos/state.html @@ -218,6 +218,37 @@

You can add Notes


+

You can add History nodes

+
+    stateDiagram-v2
+      state "A" as A {
+        state "B" as B
+        state "C" as C
+        state A_History [[history]]
+
+        B --> C
+        C --> B
+      }
+      state "D" as D {
+        state "E" as E {
+          state "F" as F
+          state "G" as G
+
+          F --> G
+          G --> F
+        }
+        state "I" as I
+        state D_History [[deephistory]]
+
+        E --> I
+        I --> E
+      }
+
+      G --> A_History
+      A --> D_History
+    
+
+