fix(moddle-copy): primitive arrays cloning

Closes https://github.com/bpmn-io/bpmn-js/issues/1518
This commit is contained in:
Niklas Kiefer 2021-11-23 15:57:26 +01:00 committed by Valentin Serra
parent 9b1096abbc
commit a7cc829458
3 changed files with 39 additions and 2 deletions

View File

@ -234,8 +234,6 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
// copying might NOT be allowed
if (copiedProperty) {
copiedProperty.$parent = parent;
return childProperties.concat(copiedProperty);
}

View File

@ -22,6 +22,11 @@
"name": "value",
"isAttr": true,
"type": "String"
},
{
"name": "paths",
"type": "String",
"isMany": true
}
]
},

View File

@ -781,6 +781,40 @@ describe('features/copy-paste/ModdleCopy', function() {
});
describe('custom', function() {
var customPackage = require('../../../fixtures/json/model/custom.json');
beforeEach(bootstrapModeler(basicXML, {
modules: testModules,
moddleExtensions: {
custom: customPackage
}
}));
it('should copy arrays of strings', inject(function(moddle, moddleCopy) {
// given
var paths = [ 'A', 'B', 'C' ];
var customElement = moddle.create('custom:CustomSendElement', {
paths: paths
});
// when
var newElement = moddleCopy.copyElement(customElement, moddle.create('custom:CustomSendElement'));
// then
expect(newElement.paths).to.have.length(3);
expect(newElement.paths).to.eql(paths);
expectNoAttrs(newElement);
}));
});
});