bpmn-js/test/spec/features/modeling/IdClaimSpec.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

import {
bootstrapModeler,
inject
} from 'test/TestHelper';
import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core';
describe('features/modeling - id claim management', function() {
var testModules = [ coreModule, modelingModule ];
2016-07-05 06:15:17 +00:00
var processDiagramXML = require('./IdClaim.bpmn');
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
// 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
// given
modeling.removeElements([ element ]);
// when
commandStack.undo();
// then
expect(moddle.ids.assigned(id)).to.eql(moddleElement);
}));
});
});