2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
describe('features/modeling/behavior - create boundary events', function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
var testModules = [ coreModule, modelingModule ];
|
|
|
|
|
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
var processDiagramXML = require('../../../../fixtures/bpmn/collaboration/process-empty.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules.concat(modelingModule) }));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
it('should execute on attach', inject(function(canvas, elementFactory, modeling) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// given
|
|
|
|
var rootElement = canvas.getRootElement(),
|
|
|
|
task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
intermediateEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
modeling.createShape(task, { x: 100, y: 100 }, rootElement);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// when
|
2017-12-20 09:36:07 +00:00
|
|
|
var newEvent = modeling.createShape(intermediateEvent, { x: 50 + 15, y: 100 }, task, { attach: true });
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// then
|
|
|
|
expect(newEvent.type).to.equal('bpmn:BoundaryEvent');
|
|
|
|
expect(newEvent.businessObject.attachedToRef).to.equal(task.businessObject);
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
it('should NOT execute on drop', inject(function(canvas, elementFactory, modeling) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// given
|
|
|
|
var rootElement = canvas.getRootElement(),
|
|
|
|
subProcess = elementFactory.createShape({ type: 'bpmn:SubProcess', isExpanded: true }),
|
|
|
|
intermediateEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
modeling.createShape(subProcess, { x: 300, y: 200 }, rootElement);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// when
|
|
|
|
var newEvent = modeling.createShape(intermediateEvent, { x: 300, y: 200 }, subProcess);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-08-06 07:41:17 +00:00
|
|
|
// then
|
|
|
|
expect(newEvent).to.exist;
|
|
|
|
expect(newEvent.type).to.equal('bpmn:IntermediateThrowEvent');
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
});
|