fix(copy-paste): correctly set $parent on copied model elements

Related to camunda/camunda-modeler#625
This commit is contained in:
Nico Rehwaldt 2018-04-09 11:25:18 +02:00
parent b4fcb2d906
commit e159b002cd
2 changed files with 8 additions and 2 deletions

View File

@ -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;

View File

@ -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);
})
);