diff --git a/lib/util/model/ModelCloneHelper.js b/lib/util/model/ModelCloneHelper.js index 67b2aa71..6fd48fde 100644 --- a/lib/util/model/ModelCloneHelper.js +++ b/lib/util/model/ModelCloneHelper.js @@ -106,7 +106,9 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties) newProperty = self._deepClone(refElementProp, context); if (context.hasNestedProperty) { - newElement[name] = newProperty; + newProperty.$parent = newElement; + + newElement.set(name, newProperty); } context.hasNestedProperty = false; diff --git a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js index 634ad657..5fd735d2 100644 --- a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +++ b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js @@ -664,7 +664,11 @@ describe('features/copy-paste', function() { expect(copiedBo.asyncBefore).to.eql(bo.asyncBefore); expect(copiedBo.documentation).to.jsonEqual(bo.documentation); - expect(copiedBo.extensionElements).to.jsonEqual(bo.extensionElements); + + var copiedExtensions = copiedBo.extensionElements; + + expect(copiedExtensions).to.jsonEqual(bo.extensionElements); + expect(copiedExtensions.$parent).to.equal(copiedBo); }) );