bpmn-js/test/spec/features/modeling/behavior/BoundaryEventBehaviorSpec.js

55 lines
1.6 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/behavior - boundary event', function() {
var testModules = [ coreModule, modelingModule ];
var diagramXML = require('./BoundaryEvent.bpmn');
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;
}));
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;
}));
});