From 6d54ff34e3b0d7c80b72d2ec6b940e015b681e98 Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Wed, 17 Oct 2018 16:14:28 +0200 Subject: [PATCH] chore(boundary-event-behavior): clean up tests --- .../behavior/BoundaryEventBehavior.js | 6 +- .../behavior/BoundaryEventBehaviorSpec.js | 65 +++++++++++-------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/lib/features/modeling/behavior/BoundaryEventBehavior.js b/lib/features/modeling/behavior/BoundaryEventBehavior.js index b5dbd225..24501f47 100644 --- a/lib/features/modeling/behavior/BoundaryEventBehavior.js +++ b/lib/features/modeling/behavior/BoundaryEventBehavior.js @@ -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); diff --git a/test/spec/features/modeling/behavior/BoundaryEventBehaviorSpec.js b/test/spec/features/modeling/behavior/BoundaryEventBehaviorSpec.js index 2333a6df..2b668f16 100644 --- a/test/spec/features/modeling/behavior/BoundaryEventBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/BoundaryEventBehaviorSpec.js @@ -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; + }) + ); + + }); }); \ No newline at end of file