diff --git a/.changeset/six-tigers-clap.md b/.changeset/six-tigers-clap.md new file mode 100644 index 0000000000..7c15dc4889 --- /dev/null +++ b/.changeset/six-tigers-clap.md @@ -0,0 +1,5 @@ +--- +'mermaid': patch +--- + +Display no arrows for open links diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts index 5983bf04cd..5221f19beb 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.spec.ts @@ -65,3 +65,36 @@ describe('flow db addClass', () => { expect(classes.get('a')?.styles).toEqual(['stroke-width: 8px']); }); }); + +describe('flow db getData', () => { + beforeEach(() => { + flowDb.clear(); + }); + it('should end in point for for single directional arrows', () => { + flowDb.addLink(['A'], ['B'], { type: 'arrow_point' }); + + const { edges } = flowDb.getData(); + + expect(edges.length).toBe(1); + expect(edges[0].arrowTypeStart).toBe('none'); + expect(edges[0].arrowTypeEnd).toBe('arrow_point'); + }); + it('should start and end in points for multi directional arrows', () => { + flowDb.addLink(['A'], ['B'], { type: 'double_arrow_point' }); + + const { edges } = flowDb.getData(); + + expect(edges.length).toBe(1); + expect(edges[0].arrowTypeStart).toBe('arrow_point'); + expect(edges[0].arrowTypeEnd).toBe('arrow_point'); + }); + it('should have no points for open arrows', () => { + flowDb.addLink(['A'], ['B'], { type: 'arrow_open' }); + + const { edges } = flowDb.getData(); + + expect(edges.length).toBe(1); + expect(edges[0].arrowTypeStart).toBe('none'); + expect(edges[0].arrowTypeEnd).toBe('none'); + }); +}); diff --git a/packages/mermaid/src/diagrams/flowchart/flowDb.ts b/packages/mermaid/src/diagrams/flowchart/flowDb.ts index 1dbc789c92..9ed384c31d 100644 --- a/packages/mermaid/src/diagrams/flowchart/flowDb.ts +++ b/packages/mermaid/src/diagrams/flowchart/flowDb.ts @@ -872,6 +872,9 @@ const destructEdgeType = (type: string | undefined) => { arrowTypeStart = type.replace('double_', ''); arrowTypeEnd = arrowTypeStart; break; + case 'arrow_open': + arrowTypeEnd = 'none'; + break; } return { arrowTypeStart, arrowTypeEnd }; };