parent
9366700235
commit
4e161427b8
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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