2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2016-04-18 14:15:00 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2016-04-18 14:15:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('features/modeling - id claim management', function() {
|
|
|
|
|
|
|
|
var testModules = [ coreModule, modelingModule ];
|
|
|
|
|
2016-07-05 06:15:17 +00:00
|
|
|
var processDiagramXML = require('./IdClaim.bpmn');
|
2016-04-18 14:15:00 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
var element, moddleElement, id;
|
|
|
|
|
|
|
|
beforeEach(inject(function(elementRegistry, moddle) {
|
|
|
|
id = 'StartEvent_2';
|
|
|
|
element = elementRegistry.get(id);
|
|
|
|
moddleElement = element.businessObject;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
describe('unclaim', function() {
|
|
|
|
|
|
|
|
it('should unclaim id when removing element', inject(function(modeling, moddle) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2016-04-18 14:15:00 +00:00
|
|
|
// when
|
|
|
|
modeling.removeElements([ element ]);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(moddle.ids.assigned(id)).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should revert unclaim action on restoring element', inject(function(modeling, moddle, commandStack) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2016-04-18 14:15:00 +00:00
|
|
|
// given
|
|
|
|
modeling.removeElements([ element ]);
|
|
|
|
|
|
|
|
// when
|
|
|
|
commandStack.undo();
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(moddle.ids.assigned(id)).to.eql(moddleElement);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|