diff --git a/lib/features/copy-paste/BpmnCopyPaste.js b/lib/features/copy-paste/BpmnCopyPaste.js index b7edf679..99c07301 100644 --- a/lib/features/copy-paste/BpmnCopyPaste.js +++ b/lib/features/copy-paste/BpmnCopyPaste.js @@ -145,6 +145,7 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) { ); newDi = bpmnFactory.create(oldDi.$type); + newDi.bpmnElement = newBusinessObject; descriptor.di = moddleCopy.copyElement( oldDi, diff --git a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js index b09925b7..d3c6686c 100644 --- a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +++ b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js @@ -463,6 +463,35 @@ describe('features/copy-paste', function() { } )); + + it('should wire DIs correctly', inject( + function(canvas, copyPaste, elementRegistry) { + + // given + var subprcoess = elementRegistry.get('SubProcess_1'), + rootElement = canvas.getRootElement(); + + copyPaste.copy(subprcoess); + + // when + var elements = copyPaste.paste({ + element: rootElement, + point: { + x: 300, + y: 300 + } + }); + + // then + var subprocess = elements[0]; + var di = subprocess.di; + + expect(di).to.exist; + expect(di.bpmnElement).to.exist; + expect(di.bpmnElement).to.equal(subprocess.businessObject); + } + )); + });