From 0cb46183eb1c61be3d3d8acf6957d079a2990d91 Mon Sep 17 00:00:00 2001 From: felixlinker Date: Fri, 10 Nov 2017 21:07:26 +0100 Subject: [PATCH] chore(draw/BpmnRenderer): exposed _drawPath helper This allows extensions to reuse the internal drawPath utility. Cf. #722 for context. --- lib/draw/BpmnRenderer.js | 5 +++++ test/spec/draw/BpmnRendererSpec.js | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index a454b2e3..62f45030 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -1755,6 +1755,11 @@ function BpmnRenderer(eventBus, styles, pathMap, canvas, priority) { strokeWidth: 2 }); } + + + // extension API, use at your own risk + this._drawPath = drawPath; + } diff --git a/test/spec/draw/BpmnRendererSpec.js b/test/spec/draw/BpmnRendererSpec.js index 71fe5410..1e166175 100644 --- a/test/spec/draw/BpmnRendererSpec.js +++ b/test/spec/draw/BpmnRendererSpec.js @@ -222,7 +222,7 @@ describe('draw - bpmn renderer', function() { it('should add random ID suffix to marker ID', function(done) { - + var xml = require('../../fixtures/bpmn/simple.bpmn'); bootstrapViewer(xml)(function(err) { @@ -331,4 +331,26 @@ describe('draw - bpmn renderer', function() { }); + + describe('extension API', function() { + + var diagramXML = require('../../fixtures/bpmn/simple.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { + modules: [ + coreModule, + rendererModule + ] + })); + + + it('should expose helpers', inject(function(bpmnRenderer) { + + // then + expect(bpmnRenderer._drawPath).to.be.a('function'); + + })); + + }); + });