fix(copy-paste): correctly set $parent on copied model elements
Related to camunda/camunda-modeler#625
This commit is contained in:
parent
b4fcb2d906
commit
e159b002cd
|
@ -106,7 +106,9 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties)
|
||||||
newProperty = self._deepClone(refElementProp, context);
|
newProperty = self._deepClone(refElementProp, context);
|
||||||
|
|
||||||
if (context.hasNestedProperty) {
|
if (context.hasNestedProperty) {
|
||||||
newElement[name] = newProperty;
|
newProperty.$parent = newElement;
|
||||||
|
|
||||||
|
newElement.set(name, newProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.hasNestedProperty = false;
|
context.hasNestedProperty = false;
|
||||||
|
|
|
@ -664,7 +664,11 @@ describe('features/copy-paste', function() {
|
||||||
|
|
||||||
expect(copiedBo.asyncBefore).to.eql(bo.asyncBefore);
|
expect(copiedBo.asyncBefore).to.eql(bo.asyncBefore);
|
||||||
expect(copiedBo.documentation).to.jsonEqual(bo.documentation);
|
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);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue