Merge master to develop
This commit is contained in:
commit
2ae21c3c57
|
@ -145,6 +145,7 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|||
);
|
||||
|
||||
newDi = bpmnFactory.create(oldDi.$type);
|
||||
newDi.bpmnElement = newBusinessObject;
|
||||
|
||||
descriptor.di = moddleCopy.copyElement(
|
||||
oldDi,
|
||||
|
|
|
@ -42,6 +42,10 @@ BpmnFactory.prototype._needsId = function(element) {
|
|||
};
|
||||
|
||||
BpmnFactory.prototype._ensureId = function(element) {
|
||||
if (element.id) {
|
||||
this._model.ids.claim(element.id, element);
|
||||
return;
|
||||
}
|
||||
|
||||
// generate semantic ids for elements
|
||||
// bpmn:SequenceFlow -> SequenceFlow_ID
|
||||
|
|
|
@ -47,7 +47,9 @@ export default function UnclaimIdBehavior(canvas, injector, moddle, modeling) {
|
|||
var rootElement = canvas.getRootElement(),
|
||||
rootElementBo = rootElement.businessObject;
|
||||
|
||||
moddle.ids.unclaim(rootElementBo.id);
|
||||
if (is(rootElement, 'bpmn:Collaboration')) {
|
||||
moddle.ids.unclaim(rootElementBo.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -463,6 +463,35 @@ describe('features/copy-paste', function() {
|
|||
}
|
||||
));
|
||||
|
||||
|
||||
it('should wire DIs correctly', inject(
|
||||
function(canvas, copyPaste, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subprcoess = elementRegistry.get('SubProcess_1'),
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
copyPaste.copy(subprcoess);
|
||||
|
||||
// when
|
||||
var elements = copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 300,
|
||||
y: 300
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
var subprocess = elements[0];
|
||||
var di = subprocess.di;
|
||||
|
||||
expect(di).to.exist;
|
||||
expect(di.bpmnElement).to.exist;
|
||||
expect(di.bpmnElement).to.equal(subprocess.businessObject);
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,16 @@ describe('features - bpmn-factory', function() {
|
|||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it('should claim provided id', inject(function(bpmnFactory, moddle) {
|
||||
var task = bpmnFactory.create('bpmn:Task', { id: 'foo' });
|
||||
|
||||
expect(task).to.exist;
|
||||
expect(task.id).to.eql('foo');
|
||||
expect(moddle.ids.assigned('foo')).to.exist;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -82,4 +82,21 @@ describe('features/modeling - unclaim id', function() {
|
|||
expect(moddle.ids.assigned('Collaboration_1')).to.be.false;
|
||||
}));
|
||||
|
||||
|
||||
describe('morphing', function() {
|
||||
var simpleXML = require('../../../../fixtures/bpmn/simple.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(simpleXML, { modules: testModules }));
|
||||
|
||||
it('should keep ID of root', inject(function(moddle, modeling) {
|
||||
|
||||
// when
|
||||
modeling.makeCollaboration();
|
||||
|
||||
// then
|
||||
expect(moddle.ids.assigned('Process_1')).to.exist;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue