diff --git a/lib/features/modeling/BpmnUpdater.js b/lib/features/modeling/BpmnUpdater.js index 9ee152db..18915e1d 100644 --- a/lib/features/modeling/BpmnUpdater.js +++ b/lib/features/modeling/BpmnUpdater.js @@ -54,9 +54,7 @@ export default function BpmnUpdater( this.executed([ 'connection.layout', - 'connection.create', - 'connection.reconnectEnd', - 'connection.reconnectStart' + 'connection.create' ], cropConnection); this.reverted([ 'connection.layout' ], function(e) { diff --git a/test/spec/features/modeling/BpmnUpdaterSpec.js b/test/spec/features/modeling/BpmnUpdaterSpec.js index ecdc4eef..5f0f9795 100644 --- a/test/spec/features/modeling/BpmnUpdaterSpec.js +++ b/test/spec/features/modeling/BpmnUpdaterSpec.js @@ -6,6 +6,8 @@ import { import modelingModule from 'lib/features/modeling'; import coreModule from 'lib/core'; +/* global sinon */ + var testModules = [ modelingModule, coreModule ]; @@ -89,6 +91,36 @@ describe('features - bpmn-updater', function() { }); + describe('connection cropping', function() { + + var diagramXML = require('./BpmnUpdater.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { + modules: testModules + })); + + afterEach(sinon.restore); + + + it('should crop connection only once per reconnect', inject( + function(modeling, elementRegistry, connectionDocking) { + // given + var sequenceFlow = elementRegistry.get('SequenceFlow_1'), + target = elementRegistry.get('EndEvent_2'), + cropSpy = sinon.spy(connectionDocking, 'getCroppedWaypoints'); + + // when + modeling.reconnectEnd(sequenceFlow, target, { x: 418, y: 260 }); + + // then + expect(cropSpy).to.have.been.calledOnce; + expect(cropSpy).to.have.been.calledWith(sequenceFlow); + } + )); + + }); + + describe('incomplete DI', function() { var diagramXML = require('./BpmnUpdater.incompleteDi.bpmn'); diff --git a/test/spec/features/modeling/LabelLayoutingSpec.js b/test/spec/features/modeling/LabelLayoutingSpec.js index 0ee84547..58f43506 100644 --- a/test/spec/features/modeling/LabelLayoutingSpec.js +++ b/test/spec/features/modeling/LabelLayoutingSpec.js @@ -255,8 +255,8 @@ describe('modeling - label layouting', function() { modeling.reconnectEnd(connection, shape, { x: 294, y: 270 }); // then - expect(Math.round(connection.label.x)).to.be.within(257, 260); - expect(Math.round(connection.label.y)).to.be.within(185, 186); + expect(Math.round(connection.label.x)).to.be.within(224, 228); + expect(Math.round(connection.label.y)).to.be.within(93, 97); }));