2018-10-16 10:40:56 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
|
|
|
|
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
|
|
|
|
|
|
|
|
2018-10-17 09:17:28 +00:00
|
|
|
describe('features/modeling/behavior - boundary event', function() {
|
2018-10-16 10:40:56 +00:00
|
|
|
|
|
|
|
var testModules = [ coreModule, modelingModule ];
|
|
|
|
|
2018-10-17 09:17:28 +00:00
|
|
|
var diagramXML = require('./BoundaryEvent.bpmn');
|
2018-10-16 10:40:56 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should remove the boundary event from the receive task after connecting the task with an event based gateway',
|
|
|
|
inject(function(modeling, elementRegistry) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var eventBasedGateway = elementRegistry.get('EventBasedGateway_1'),
|
|
|
|
receiveTask = elementRegistry.get('ReceiveTask_1'),
|
|
|
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.connect(eventBasedGateway, receiveTask, {
|
|
|
|
type: 'bpmn:SequenceFlow'
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(elementRegistry.get(boundaryEvent.id)).to.be.undefined;
|
|
|
|
}));
|
|
|
|
|
2018-10-17 09:17:28 +00:00
|
|
|
it('should remove Boundary from ReceiveTask after changing type of Gateway', inject(function(modeling, elementRegistry, bpmnReplace) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var gateway = elementRegistry.get('ExclusiveGateway_1'),
|
|
|
|
receiveTask = elementRegistry.get('ReceiveTask_1'),
|
|
|
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.connect(gateway, receiveTask, {
|
|
|
|
type: 'bpmn:SequenceFlow'
|
|
|
|
});
|
|
|
|
bpmnReplace.replaceElement(gateway, {
|
|
|
|
type: 'bpmn:EventBasedGateway'
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(elementRegistry.get(boundaryEvent.id)).not.to.exist;
|
|
|
|
}));
|
|
|
|
|
2018-10-16 10:40:56 +00:00
|
|
|
});
|