Merge master to develop

This commit is contained in:
github-actions 2021-10-15 11:07:21 +00:00
commit 6f421a4063
2 changed files with 31 additions and 8 deletions

View File

@ -215,8 +215,13 @@ ModdleCopy.prototype.copyProperty = function(property, parent, propertyName) {
var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
// do NOT copy Ids and references
if (propertyDescriptor.isId || propertyDescriptor.isReference) {
// do NOT copy references
if (propertyDescriptor.isReference) {
return;
}
// disallow copying IDs if already assigned
if (propertyDescriptor.isId && this._moddle.ids.assigned(property)) {
return;
}

View File

@ -98,18 +98,36 @@ describe('features/copy-paste/ModdleCopy', function() {
));
it('should NOT copy IDs', inject(function(moddle, moddleCopy) {
it('should NOT copy IDs if taken', inject(function(moddle, moddleCopy, canvas, modeling) {
// given
var task = moddle.create('bpmn:Task', {
id: 'foo'
});
var task = modeling.createShape({ type: 'bpmn:Task' },
{ x: 0, y: 0 }, canvas.getRootElement());
var taskId = task.id;
// when
var userTask = moddleCopy.copyElement(task, moddle.create('bpmn:UserTask'));
var userTask = moddleCopy.copyElement(task.businessObject, moddle.create('bpmn:UserTask'));
// then
expect(userTask.id).not.to.equal('foo');
expect(userTask.id).not.to.equal(taskId);
expectNoAttrs(userTask);
}));
it('should copy IDs if free', inject(function(moddle, moddleCopy, canvas, modeling) {
// given
var task = modeling.createShape({ type: 'bpmn:Task' },
{ x: 0, y: 0 }, canvas.getRootElement());
var taskId = task.id;
// when
modeling.removeShape(task);
var userTask = moddleCopy.copyElement(task.businessObject, moddle.create('bpmn:UserTask'));
// then
expect(userTask.id).to.equal(taskId);
expectNoAttrs(userTask);
}));