) {
+ // get HTML Element from jquery element
+ const svgElement = $p[0];
+ expect(svgElement.nodeName).equal('svg');
+
+ const sectionRoots = svgElement.getElementsByClassName('mindmap-node section-root');
+ // mindmap should have at least one root section
+ expect(sectionRoots).to.have.lengthOf.at.least(1);
+}
+
+describe('Mindmaps', () => {
+ it('Only a root', () => {
+ imgSnapshotTest(
+ `mindmap
+root
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('a root with a shape', () => {
+ imgSnapshotTest(
+ `mindmap
+root[root]
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('a root with wrapping text and a shape', () => {
+ imgSnapshotTest(
+ `mindmap
+root[A root with a long text that wraps to keep the node size in check]
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('a root with an icon', () => {
+ imgSnapshotTest(
+ `mindmap
+root[root]
+::icon(mdi mdi-fire)
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('Blang and cloud shape', () => {
+ imgSnapshotTest(
+ `mindmap
+root))bang((
+ ::icon(mdi mdi-fire)
+ a))Another bang((
+ ::icon(mdi mdi-fire)
+ a)A cloud(
+ ::icon(mdi mdi-fire)
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('Blang and cloud shape with icons', () => {
+ imgSnapshotTest(
+ `mindmap
+root))bang((
+
+ a))Another bang((
+ a)A cloud(
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('braches', () => {
+ imgSnapshotTest(
+ `mindmap
+root
+ child1
+ grandchild 1
+ grandchild 2
+ child2
+ grandchild 3
+ grandchild 4
+ child3
+ grandchild 5
+ grandchild 6
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+
+ it('braches with shapes and labels', () => {
+ imgSnapshotTest(
+ `mindmap
+root
+ child1((Circle))
+ grandchild 1
+ grandchild 2
+ child2(Round rectangle)
+ grandchild 3
+ grandchild 4
+ child3[Square]
+ grandchild 5
+ ::icon(mdi mdi-fire)
+ gc6((grand
child 6))
+ ::icon(mdi mdi-fire)
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+ it('text shouhld wrap with icon', () => {
+ imgSnapshotTest(
+ `mindmap
+root
+ Child3(A node with an icon and with a long text that wraps to keep the node size in check)
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ });
+ it('square shape', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ root[
+ The root
+ ]
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ it('rounded rect shape', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ root((
+ The root
+ ))
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ it('circle shape', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ root(
+ The root
+ )
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ it('default shape', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ The root
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ it('adding children', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ The root
+ child1
+ child2
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ it('adding grand children', () => {
+ imgSnapshotTest(
+ `
+mindmap
+ The root
+ child1
+ child2
+ child3
+ `,
+ {},
+ undefined,
+ shouldHaveRoot
+ );
+ cy.get('svg');
+ });
+ /* The end */
+});
diff --git a/cypress/integration/rendering/stateDiagram-v2.spec.js b/cypress/integration/rendering/stateDiagram-v2.spec.js
index 5b43c890c..0eca01873 100644
--- a/cypress/integration/rendering/stateDiagram-v2.spec.js
+++ b/cypress/integration/rendering/stateDiagram-v2.spec.js
@@ -559,4 +559,16 @@ stateDiagram-v2
);
});
});
+ it('1433: should render a simple state diagram with a title', () => {
+ imgSnapshotTest(
+ `---
+title: simple state diagram
+---
+stateDiagram-v2
+[*] --> State1
+State1 --> [*]
+`,
+ {}
+ );
+ });
});
diff --git a/cypress/platform/external-diagrams-mindmap.html b/cypress/platform/external-diagrams-mindmap.html
new file mode 100644
index 000000000..e5eded4ba
--- /dev/null
+++ b/cypress/platform/external-diagrams-mindmap.html
@@ -0,0 +1,49 @@
+
+
+ Should correctly load a third-party diagram using registerDiagram
+
+mindmap
+ root
+ A
+ B
+ C
+ D
+ E
+ A2
+ B2
+ C2
+ D2
+ E2
+ child1((Circle))
+ grandchild 1
+ grandchild 2
+ child2(Round rectangle)
+ grandchild 3
+ grandchild 4
+ child3[Square]
+ grandchild 5
+ ::icon(mdi mdi-fire)
+ gc6((grand
child 6))
+ ::icon(mdi mdi-fire)
+ gc7((grand
grand
child 8))
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html
index f30f993fa..084b8151e 100644
--- a/cypress/platform/knsv2.html
+++ b/cypress/platform/knsv2.html
@@ -63,24 +63,19 @@ flowchart TD
mindmap
- root((mindmap))
- Origins
- Long history
- ::icon(fa fa-book)
- Popularisation
- ::icon(fa fa-book)
- British popular psychology author Tony Buzan
- Research
- ::icon(fa fa-book)
- On effectivness
and features
- On Automatic creation
- Uses
- Creative techniques
- Strategic planning
- Argument mapping
- Tools
- Pen and paper
- Mermaid
+ root
+ child1((Circle))
+ grandchild 1
+ grandchild 2
+ child2(Round rectangle)
+ grandchild 3
+ grandchild 4
+ child3[Square]
+ grandchild 5
+ ::icon(mdi mdi-fire)
+ gc6((grand
child 6))
+ ::icon(mdi mdi-fire)
+ gc7((grand
grand
child 8))
gantt
diff --git a/cypress/platform/render-after-error.html b/cypress/platform/render-after-error.html
index 059f79345..f5165e0ee 100644
--- a/cypress/platform/render-after-error.html
+++ b/cypress/platform/render-after-error.html
@@ -14,16 +14,14 @@
mermaid.init({ startOnLoad: false });
mermaid.mermaidAPI.initialize({ securityLevel: 'strict' });
- (async () => {
- try {
- console.log('rendering');
- await mermaid.mermaidAPI.render('graphDiv', `>`);
- } catch (e) {}
+ try {
+ console.log('rendering');
+ mermaid.mermaidAPI.render('graphDiv', `>`);
+ } catch (e) {}
- await mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
- document.getElementById('graph').innerHTML = html;
- });
- })();
+ mermaid.mermaidAPI.render('graphDiv', `graph LR\n a --> b`, (html) => {
+ document.getElementById('graph').innerHTML = html;
+ });