diff --git a/lib/features/modeling/behavior/DropOnFlowBehavior.js b/lib/features/modeling/behavior/DropOnFlowBehavior.js index a08947d2..ef843a0a 100644 --- a/lib/features/modeling/behavior/DropOnFlowBehavior.js +++ b/lib/features/modeling/behavior/DropOnFlowBehavior.js @@ -102,7 +102,7 @@ export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) { }) || [], outgoingConnection && filter(oldOutgoing, function(connection) { - return connection.source === outgoingConnection.source; + return connection.target === outgoingConnection.target; }) || [] ); diff --git a/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn b/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn index 67050aa7..9490c872 100644 --- a/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn +++ b/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -25,6 +25,20 @@ + + SequenceFlow_D + + + SequenceFlow_D + + + + SequenceFlow_F + + + SequenceFlow_F + + @@ -86,6 +100,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js index e98675d5..5519e2f2 100644 --- a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js @@ -281,6 +281,7 @@ describe('modeling/behavior - drop on connection', function() { dragging.setOptions({ manual: true }); })); + it('should connect start -> target -> end', inject( function(dragging, move, elementRegistry, selection) { @@ -469,6 +470,36 @@ describe('modeling/behavior - drop on connection', function() { )); + it('should connect start -> target -> end (keeping target outgoing flows)', inject( + function(elementRegistry, selection, move, dragging) { + + // given + var gateway_C = elementRegistry.get('Gateway_C'), + task_B = elementRegistry.get('task_B'), + sequenceFlow = elementRegistry.get('SequenceFlow_D'), + sequenceFlowGfx = elementRegistry.getGraphics(sequenceFlow); + + // when + selection.select(gateway_C); + + move.start(canvasEvent({ x: 0, y: 0 }), gateway_C); + + dragging.hover({ + element: sequenceFlow, + gfx: sequenceFlowGfx + }); + + dragging.move(canvasEvent({ x: 160, y: -130 })); + dragging.end(); + + // then + expect(gateway_C.outgoing).to.have.length(2); + + expect(gateway_C.outgoing[0].gateway_C).to.eql(task_B); + } + )); + + it('should connect start -> target', inject( function(modeling, elementRegistry, selection, move, dragging) {