Merge master to develop
This commit is contained in:
commit
6f421a4063
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue