mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 17:56:43 +02:00
add cypress tests for classDefs and applying classes to states
This commit is contained in:

parent
7b7db4f60e
commit
d1f3b889d6
@@ -521,4 +521,42 @@ stateDiagram-v2
|
|||||||
{ logLevel: 0, fontFamily: 'courier' }
|
{ 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' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user