From fe9d4ff06d82628716907a03af2957dabc9129f0 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 29 Mar 2019 11:17:13 +0100 Subject: [PATCH] feat(modeling): ensure wrapping DataInput/Output in participant works --- lib/features/modeling/BpmnUpdater.js | 4 ++++ .../features/modeling/MoveElementsSpec.js | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/lib/features/modeling/BpmnUpdater.js b/lib/features/modeling/BpmnUpdater.js index 5d58ff82..9ee152db 100644 --- a/lib/features/modeling/BpmnUpdater.js +++ b/lib/features/modeling/BpmnUpdater.js @@ -494,6 +494,10 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent, if (is(businessObject, 'bpmn:DataInput') || is(businessObject, 'bpmn:DataOutput')) { + if (is(newParent, 'bpmn:Participant') && 'processRef' in newParent) { + newParent = newParent.processRef; + } + // already in correct ioSpecification if ('ioSpecification' in newParent && newParent.ioSpecification === businessObject.$parent) { return; diff --git a/test/spec/features/modeling/MoveElementsSpec.js b/test/spec/features/modeling/MoveElementsSpec.js index d3ab8e58..62c2b640 100644 --- a/test/spec/features/modeling/MoveElementsSpec.js +++ b/test/spec/features/modeling/MoveElementsSpec.js @@ -152,6 +152,27 @@ describe('features/modeling - move elements', function() { }); })); + + it('should wrap in participant', inject( + function(elementRegistry, elementFactory, modeling, canvas) { + + // given + var dataInput = elementRegistry.get('DataInput'); + var dataOutput = elementRegistry.get('DataOutput'); + + var processShape = canvas.getRootElement(), + processBo = processShape.businessObject, + participantShape = elementFactory.createParticipantShape(true); + + // when + modeling.createShape(participantShape, { x: 350, y: 200 }, processShape); + + // then + expect(dataInput.businessObject.$parent).to.eql(processBo.ioSpecification); + expect(dataOutput.businessObject.$parent).to.eql(processBo.ioSpecification); + } + )); + });