Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2055 Allowing multiple ids for one state in state diagrams #2056

Merged
merged 1 commit into from
May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cypress/integration/rendering/stateDiagram-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,19 @@ stateDiagram-v2
}
);
});
it('v2 should handle multiple notes added to one state', () => {
imgSnapshotTest(
`
stateDiagram-v2
MyState
note left of MyState : I am a leftie
note right of MyState : I am a rightie
`,
{
logLevel: 0, fontFamily: 'courier',
}
);
});
it('v2 handle transition from one state in a composite state to a composite state', () => {
imgSnapshotTest(
`
Expand Down
43 changes: 8 additions & 35 deletions cypress/platform/knsv.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<style>
body {
/* background: rgb(221, 208, 208); */
background:#333;
/* background:#333; */
font-family: 'Arial';
/* font-size: 18px !important; */
}
Expand All @@ -28,39 +28,12 @@
<div class="flex">

<div class="mermaid" style="width: 100%; height: 20%;">
%%{init:{
"themeVariables": {
"transitionColor":"red",
"labelColor":"yellow",
"transitionLabelColor":"blue",
"stateBkg":"green",
"compositeBackground":"pink",
"altBackground":"purple",
"clusterTitleBackground":"blue",
"stateBorder":"red",
"noteBorderColor":"#522",
"noteBkgColor":"#522",
"noteTextColor":"white"
}}}%%
%%{int:{
"themeVariables": {
"altBackground":"purple"
}}}%%
stateDiagram-v2
state CompositeState {
state AnotherCompositeState {
AnotherState --> YetANotherState:a label
}
--
stateDiagram
MyState
}
note left of CompositeState
Important information! You can write
notes.
end note

note left of MyState : I am a leftie
note right of MyState : I am a rightie
</div>
<div class="mermaid" style="width: 100%; height: 20%;">
<div class="mermaid2" style="width: 100%; height: 20%;">
%%{int:{
"themeVariables": {
"transitionColor":"red",
Expand All @@ -80,7 +53,7 @@
}

</div>
<div class="mermaid" style="width: 100%; height: 20%;">
<div class="mermaid2" style="width: 100%; height: 20%;">
sequenceDiagram
Alice->>+John: Hello John, how are you?
Alice->>+John: John, can you hear me?
Expand All @@ -94,7 +67,7 @@
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
theme: 'neutral',
theme: 'default',
arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
Expand All @@ -108,7 +81,7 @@
state:{
nodeSpacing: 50,
rankSpacing: 50,
// defaultRenderer: 'dagre-wrapper',
defaultRenderer: 'dagre-wrapper',
},

fontSize: 18,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/state/stateRenderer-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const setupNode = (g, parent, node, altFlag) => {
labelText: node.note.text,
classes: 'statediagram-note', //classStr,
style: '', //styles.style,
id: node.id + '----note',
id: node.id + '----note-' + cnt,
domId: 'state-' + node.id + '----note-' + cnt,
type: nodeDb[node.id].type,
padding: 15 //getConfig().flowchart.padding
Expand Down