From d1f3b889d601f26782e621e7f046991abcc8bbf3 Mon Sep 17 00:00:00 2001 From: "Ashley Engelund (weedySeaDragon @ github)" Date: Mon, 10 Oct 2022 22:03:22 -0700 Subject: [PATCH] add cypress tests for classDefs and applying classes to states --- .../rendering/stateDiagram-v2.spec.js | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/cypress/integration/rendering/stateDiagram-v2.spec.js b/cypress/integration/rendering/stateDiagram-v2.spec.js index aa2bc06ef..5b43c890c 100644 --- a/cypress/integration/rendering/stateDiagram-v2.spec.js +++ b/cypress/integration/rendering/stateDiagram-v2.spec.js @@ -521,4 +521,42 @@ stateDiagram-v2 { logLevel: 0, fontFamily: 'courier' } ); }); + + describe('classDefs and applying classes', () => { + it('v2 states can have a class applied', () => { + imgSnapshotTest( + ` + stateDiagram-v2 + [*] --> A + A --> B: test({ foo#colon; 'far' }) + B --> [*] + classDef badBadEvent fill:#f00,color:white,font-weight:bold + class B badBadEvent + `, + { logLevel: 0, fontFamily: 'courier' } + ); + }); + it('v2 can have multiple classes applied to multiple states', () => { + imgSnapshotTest( + ` + stateDiagram-v2 + classDef notMoving fill:white + classDef movement font-style:italic; + classDef badBadEvent fill:#f00,color:white,font-weight:bold + + [*] --> Still + Still --> [*] + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*] + + class Still notMoving + class Moving, Crash movement + class Crash badBadEvent + `, + { logLevel: 0, fontFamily: 'courier' } + ); + }); + }); });