diff --git a/lib/features/rules/BpmnRules.js b/lib/features/rules/BpmnRules.js index 6e3500a8..75879bf5 100644 --- a/lib/features/rules/BpmnRules.js +++ b/lib/features/rules/BpmnRules.js @@ -104,8 +104,9 @@ BpmnRules.prototype.init = function() { }); this.addRule('connection.updateWaypoints', function(context) { - // OK! but visually ignore - return null; + return { + type: context.connection.type + }; }); this.addRule('shape.resize', function(context) { diff --git a/test/spec/features/modeling/layout/LayoutConnectionSpec.js b/test/spec/features/modeling/layout/LayoutConnectionSpec.js index 5dac1a4e..1a635422 100644 --- a/test/spec/features/modeling/layout/LayoutConnectionSpec.js +++ b/test/spec/features/modeling/layout/LayoutConnectionSpec.js @@ -334,6 +334,62 @@ describe('features/modeling - layout connection', function() { expect(task1.incoming[0].waypoints).to.deep.eql(waypointsPreview); }) ); + + + it('should correctly lay out connection preview on inserted bendpoint move', + inject(function(bendpointMove, dragging, elementRegistry) { + + // given + var task2 = elementRegistry.get('Task_2'), + sequenceFlow1 = elementRegistry.get('SequenceFlow_1'); + + // when + bendpointMove.start(canvasEvent({ x: 700, y: 341 }), sequenceFlow1, 1, true); + + dragging.move(canvasEvent({ x: 700, y: 400 })); + + var ctx = dragging.context(); + var context = ctx.data.context; + + var connectionPreview = context.getConnection(context.allowed); + + var waypointsPreview = connectionPreview.waypoints.slice(); + + dragging.end(); + + // then + expect(task2.incoming[0]).to.exist; + expect(task2.incoming[0].waypoints).to.deep.eql(waypointsPreview); + }) + ); + + + it('should correctly lay out connection preview on existing bendpoint move', + inject(function(bendpointMove, dragging, elementRegistry) { + + // given + var task2 = elementRegistry.get('Task_2'), + sequenceFlow1 = elementRegistry.get('SequenceFlow_1'); + + // when + bendpointMove.start(canvasEvent({ x: 934, y: 341 }), sequenceFlow1, 1); + + dragging.move(canvasEvent({ x: 960, y: 340 })); + + var ctx = dragging.context(); + var context = ctx.data.context; + + var connectionPreview = context.getConnection(context.allowed); + + var waypointsPreview = connectionPreview.waypoints.slice(); + + dragging.end(); + + // then + expect(task2.incoming[0]).to.exist; + expect(task2.incoming[0].waypoints).to.deep.eql(waypointsPreview); + }) + ); }); });