chore(boundary-event-behavior): clean up tests

This commit is contained in:
Philipp Fromme 2018-10-17 16:14:28 +02:00 committed by merge-me[bot]
parent 178e1cfccb
commit 6d54ff34e3
2 changed files with 40 additions and 31 deletions

View File

@ -13,7 +13,7 @@ import {
/**
* BPMN specific boundary event behavior
*/
export default function ConnectEventBasedGatewayBehavior(eventBus, modeling) {
export default function BoundaryEventBehavior(eventBus, modeling) {
CommandInterceptor.call(this, eventBus);
@ -59,9 +59,9 @@ export default function ConnectEventBasedGatewayBehavior(eventBus, modeling) {
});
}
ConnectEventBasedGatewayBehavior.$inject = [
BoundaryEventBehavior.$inject = [
'eventBus',
'modeling'
];
inherits(ConnectEventBasedGatewayBehavior, CommandInterceptor);
inherits(BoundaryEventBehavior, CommandInterceptor);

View File

@ -16,40 +16,49 @@ describe('features/modeling/behavior - boundary event', function() {
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) {
describe('implicitly removing boundary events', function() {
// given
var eventBasedGateway = elementRegistry.get('EventBasedGateway_1'),
receiveTask = elementRegistry.get('ReceiveTask_1'),
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
it('after connecting to event-based gateway',
inject(function(modeling, elementRegistry) {
// when
modeling.connect(eventBasedGateway, receiveTask, {
type: 'bpmn:SequenceFlow'
});
// given
var eventBasedGateway = elementRegistry.get('EventBasedGateway_1'),
receiveTask = elementRegistry.get('ReceiveTask_1'),
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
// then
expect(elementRegistry.get(boundaryEvent.id)).to.be.undefined;
}));
// when
modeling.connect(eventBasedGateway, receiveTask, {
type: 'bpmn:SequenceFlow'
});
it('should remove Boundary from ReceiveTask after changing type of Gateway', inject(function(modeling, elementRegistry, bpmnReplace) {
// then
expect(elementRegistry.get(boundaryEvent.id)).not.to.exist;
})
);
// 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'
});
it('after replacing connected gateway with event-based gateway',
inject(function(modeling, elementRegistry, bpmnReplace) {
// then
expect(elementRegistry.get(boundaryEvent.id)).not.to.exist;
}));
// given
var gateway = elementRegistry.get('ExclusiveGateway_1'),
receiveTask = elementRegistry.get('ReceiveTask_1'),
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
modeling.connect(gateway, receiveTask, {
type: 'bpmn:SequenceFlow'
});
// when
bpmnReplace.replaceElement(gateway, {
type: 'bpmn:EventBasedGateway'
});
// then
expect(elementRegistry.get(boundaryEvent.id)).not.to.exist;
})
);
});
});