From 568962dadf0a21a82876df0858f5b7df43f7e3c8 Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Sun, 6 Dec 2020 11:03:24 +0100 Subject: [PATCH] interaction test update --- .../parser/flow-interactions.spec.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/diagrams/flowchart/parser/flow-interactions.spec.js b/src/diagrams/flowchart/parser/flow-interactions.spec.js index 9255b9ce9..2aa814dbe 100644 --- a/src/diagrams/flowchart/parser/flow-interactions.spec.js +++ b/src/diagrams/flowchart/parser/flow-interactions.spec.js @@ -14,22 +14,24 @@ describe('[Interactions] when parsing', () => { it('it should be possible to use click to a callback', function() { spyOn(flowDb, 'setClickEvent'); - const res = flow.parser.parse('graph TD\nA-->B\nclick A callback'); + const res = flow.parser.parse('graph TD\nA-->B\nclick A call callback()'); const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', undefined); + expect(flowDb.setClickEvent).toHaveBeenCalledWith('A', 'callback'); }); it('it should be possible to use click to a callback with toolip', function() { spyOn(flowDb, 'setClickEvent'); - const res = flow.parser.parse('graph TD\nA-->B\nclick A callback "tooltip"'); + spyOn(flowDb, 'setTooltip'); + const res = flow.parser.parse('graph TD\nA-->B\nclick A call callback() "tooltip"'); const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setClickEvent).toHaveBeenCalledWith('A', 'callback', 'tooltip'); + expect(flowDb.setClickEvent).toHaveBeenCalledWith('A', 'callback'); + expect(flowDb.setTooltip).toHaveBeenCalledWith('tooltip'); }); it('should handle interaction - click to a link', function() { @@ -39,17 +41,19 @@ describe('[Interactions] when parsing', () => { const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', undefined, undefined); + expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html'); }); it('should handle interaction - click to a link with tooltip', function() { spyOn(flowDb, 'setLink'); + spyOn(flowDb, 'setTooltip'); const res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html" "tooltip"'); const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', 'tooltip', undefined); + expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html'); + expect(flowDb.setTooltip).toHaveBeenCalledWith('tooltip'); }); it('should handle interaction - click to a link with target', function() { @@ -59,16 +63,18 @@ describe('[Interactions] when parsing', () => { const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', undefined, '_blank'); + expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', '_blank'); }); it('should handle interaction - click to a link with tooltip and target', function() { spyOn(flowDb, 'setLink'); + spyOn(flowDb, 'setTooltip'); const res = flow.parser.parse('graph TD\nA-->B\nclick A "click.html" "tooltip" _blank'); const vert = flow.parser.yy.getVertices(); const edges = flow.parser.yy.getEdges(); - expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', 'tooltip', '_blank'); + expect(flowDb.setLink).toHaveBeenCalledWith('A', 'click.html', '_blank'); + expect(flowDb.setTooltip).toHaveBeenCalledWith('tooltip'); }); });