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 * BPMN specific boundary event behavior
*/ */
export default function ConnectEventBasedGatewayBehavior(eventBus, modeling) { export default function BoundaryEventBehavior(eventBus, modeling) {
CommandInterceptor.call(this, eventBus); CommandInterceptor.call(this, eventBus);
@ -59,9 +59,9 @@ export default function ConnectEventBasedGatewayBehavior(eventBus, modeling) {
}); });
} }
ConnectEventBasedGatewayBehavior.$inject = [ BoundaryEventBehavior.$inject = [
'eventBus', 'eventBus',
'modeling' '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 })); beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
it('should remove the boundary event from the receive task after connecting the task with an event based gateway', describe('implicitly removing boundary events', function() {
inject(function(modeling, elementRegistry) {
// given it('after connecting to event-based gateway',
var eventBasedGateway = elementRegistry.get('EventBasedGateway_1'), inject(function(modeling, elementRegistry) {
receiveTask = elementRegistry.get('ReceiveTask_1'),
boundaryEvent = elementRegistry.get('BoundaryEvent_1');
// when // given
modeling.connect(eventBasedGateway, receiveTask, { var eventBasedGateway = elementRegistry.get('EventBasedGateway_1'),
type: 'bpmn:SequenceFlow' receiveTask = elementRegistry.get('ReceiveTask_1'),
}); boundaryEvent = elementRegistry.get('BoundaryEvent_1');
// then // when
expect(elementRegistry.get(boundaryEvent.id)).to.be.undefined; 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 it('after replacing connected gateway with event-based gateway',
modeling.connect(gateway, receiveTask, { inject(function(modeling, elementRegistry, bpmnReplace) {
type: 'bpmn:SequenceFlow'
});
bpmnReplace.replaceElement(gateway, {
type: 'bpmn:EventBasedGateway'
});
// then // given
expect(elementRegistry.get(boundaryEvent.id)).not.to.exist; 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;
})
);
});
}); });