From e99d872f2b86012f164d6b28fd90b2d77a13fd79 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Sun, 1 Dec 2019 09:15:56 +0100 Subject: [PATCH 1/4] Create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..bbda16a663 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [knsv] +#patreon: # Replace with a single Patreon username +#open_collective: # Replace with a single Open Collective username +#ko_fi: # Replace with a single Ko-fi username +#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +#liberapay: # Replace with a single Liberapay username +#issuehunt: # Replace with a single IssueHunt username +#otechie: # Replace with a single Otechie username +#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 346328156ab668b9299e905407b01bdab6b8ab99 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Mon, 2 Dec 2019 21:10:37 +0100 Subject: [PATCH 2/4] #1110 Adding tests for this case and some calcuations for width --- cypress/integration/rendering/current.spec.js | 21 +- .../rendering/stateDiagram.spec.js | 45 ++++ cypress/platform/current.html | 53 ++++- src/diagrams/state/shapes.js | 211 +++++++++++++++--- src/diagrams/state/stateRenderer.js | 6 +- 5 files changed, 288 insertions(+), 48 deletions(-) diff --git a/cypress/integration/rendering/current.spec.js b/cypress/integration/rendering/current.spec.js index 1ed1c9d5cd..bd4eb888b5 100644 --- a/cypress/integration/rendering/current.spec.js +++ b/cypress/integration/rendering/current.spec.js @@ -2,19 +2,20 @@ import { imgSnapshotTest } from '../../helpers/util'; describe('State diagram', () => { - it('should render a flowchart full of circles', () => { + it('should render a state with states in it', () => { imgSnapshotTest( ` - stateDiagram - State1: The state with a note - note right of State1 - Important information! You\ncan write - notes with multiple lines... - Here is another line... - And another line... - end note + stateDiagram + state PersonalizedCockpit { + Other + state Parent { + C + } + } `, - {} + { + logLevel: 0, + } ); }); }); diff --git a/cypress/integration/rendering/stateDiagram.spec.js b/cypress/integration/rendering/stateDiagram.spec.js index e4231261e8..0ab68713ef 100644 --- a/cypress/integration/rendering/stateDiagram.spec.js +++ b/cypress/integration/rendering/stateDiagram.spec.js @@ -106,6 +106,22 @@ describe('State diagram', () => { ); cy.get('svg'); }); + it('should render a note with multiple lines in it', () => { + imgSnapshotTest( + ` + stateDiagram + State1: The state with a note + note right of State1 + Important information! You\ncan write + notes with multiple lines... + Here is another line... + And another line... + end note + `, + {} + ); + }); + it('should render a states with descriptions including multi-line descriptions', () => { imgSnapshotTest( ` @@ -276,4 +292,33 @@ describe('State diagram', () => { ); cy.get('svg'); }); + it('should render a state with states in it', () => { + imgSnapshotTest( + ` + stateDiagram + state PilotCockpit { + state Parent { + C + } + } + `, + { + logLevel: 0, + } + ); + }); + it('Simplest compone state', () => { + imgSnapshotTest( + ` + stateDiagram + state Parent { + C + } + `, + { + logLevel: 0, + } + ); + }); + }); diff --git a/cypress/platform/current.html b/cypress/platform/current.html index c586863d94..4cf13b1cf4 100644 --- a/cypress/platform/current.html +++ b/cypress/platform/current.html @@ -8,12 +8,55 @@

info below

-
graph TB - a --> b - a --> c - a --> d +
+
stateDiagram + state P { + Child + } +
+ +
stateDiagram + state P { + state Par { + Child + } + } +
+
stateDiagram + state P { + state GPar { + state Parent { + TheLongChild + } + } + } +
+
+
+
stateDiagram + state Parent { + C + } +
+ +
stateDiagram + state PilotCockpit { + state Parent { + C + } + } +
+
stateDiagram + state PilotCockpit { + state GParent { + state Parent { + Child + } + } + }
- +
+