From fd88b424b4d3094ed08d00d24e4e8d98967e141a Mon Sep 17 00:00:00 2001 From: Ibrahim Wassouf Date: Sat, 22 Jul 2023 15:09:24 -0300 Subject: [PATCH] Add unit test for vertex and edge having both strings and text --- .../src/diagrams/flowchart/parser/flow-text.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js b/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js index a64f39ef0..922508e80 100644 --- a/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js +++ b/packages/mermaid/src/diagrams/flowchart/parser/flow-text.spec.js @@ -690,4 +690,16 @@ describe('[Text] when parsing', () => { expect(vert['A'].text).toBe(',.?!+-*'); expect(edges[0].text).toBe(',.?!+-*'); }); + + it('should handle strings and text at the same time', function () { + const res = flow.parser.parse( + 'graph TD;A(this node has "string" and text)-->|this link has "string" and text|C;' + ); + + const vert = flow.parser.yy.getVertices(); + const edges = flow.parser.yy.getEdges(); + + expect(vert['A'].text).toBe('this node has "string" and text'); + expect(edges[0].text).toBe('this link has "string" and text'); + }); });