2015-04-16 07:11:04 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var Helper = require('./Helper');
|
|
|
|
|
|
|
|
var expectCanConnect = Helper.expectCanConnect,
|
|
|
|
expectCanDrop = Helper.expectCanDrop,
|
|
|
|
expectCanMove = Helper.expectCanMove;
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
/* global bootstrapModeler, inject */
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var modelingModule = require('../../../../lib/features/modeling'),
|
|
|
|
coreModule = require('../../../../lib/core');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('features/modeling/rules - BpmnRules', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testModules = [ coreModule, modelingModule ];
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('on process diagram', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testXML = require('./BpmnRules.process.bpmn');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'Task', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> TextAnnotation', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'TextAnnotation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect Task -> IntermediateThrowEvent_Link', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateThrowEvent_Link', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect IntermediateThrowEvent_Link -> EndEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('IntermediateThrowEvent_Link', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> IntermediateCatchEvent_Link', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'IntermediateCatchEvent_Link', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect IntermediateCatchEvent_Link -> Task', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('IntermediateCatchEvent_Link', 'Task', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('drop TextAnnotation -> Process', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanDrop('TextAnnotation', 'Process', true);
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-10-06 10:33:21 +00:00
|
|
|
|
|
|
|
it('connect DataObjectReference -> StartEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'StartEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect StartEvent_None -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'DataObjectReference', {
|
2015-10-21 14:25:56 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> EndEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EndEvent_None -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None', 'DataObjectReference', {
|
2015-10-06 10:33:21 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect Task -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'DataObjectReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect SubProcess -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('SubProcess', 'DataObjectReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> SubProcess', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'SubProcess', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('boundary events', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testXML = require('./BpmnRules.boundaryEvent.bpmn');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'Task', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> ExclusiveGateway', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'ExclusiveGateway', {
|
|
|
|
sequenceFlow: true,
|
2015-04-16 07:11:04 +00:00
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'SubProcess', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_on_Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_on_Task', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> StartEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'StartEvent_None', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> BoundaryEvent_on_SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'BoundaryEvent_on_SubProcess', {
|
|
|
|
sequenceFlow: false,
|
2015-04-16 07:11:04 +00:00
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_nested -> Task', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_nested', 'Task', {
|
|
|
|
sequenceFlow: false,
|
2015-07-13 08:37:43 +00:00
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_nested -> EndEvent_nested', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_nested', 'EndEvent_nested', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_in_OtherProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_in_OtherProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> Task_in_OtherProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect Task_in_OtherProcess -> BoundaryEvent_on_SubProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('Task_in_OtherProcess', 'BoundaryEvent_on_SubProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
2015-07-30 08:48:17 +00:00
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event based gateway', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.eventBasedGateway.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Signal', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Signal', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Condition', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Condition', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Timer', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Timer', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateThrowEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> ReceiveTask', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ReceiveTask', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> Task_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'Task_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EventBasedGateway -> ParallelGateway', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ParallelGateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
it('connect EventBasedGateway -> ParallelGateway', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ParallelGateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
describe('compensation', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.compensation.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> TaskForCompensation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'TaskForCompensation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> Gateway', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'Gateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> IntermediateEvent', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'IntermediateEvent', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect Task -> TaskForCompensation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'TaskForCompensation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect TaskForCompensation -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('TaskForCompensation', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
describe('on collaboration diagram', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collaboration.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> IntermediateEvent', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_Timer', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_Timer', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_Message', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_None -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_Cancel -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_Cancel', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_Message -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_Message', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> EndEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_Message -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_Message', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_None -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_Signal -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_Signal', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> IntermediateThrowEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect Task_in_SubProcess -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('Task_in_SubProcess', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_None_in_SubProcess -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None_in_SubProcess', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> Task_in_SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'Task_in_SubProcess', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect Participant -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('Participant', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> TextAnnotation_OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'TextAnnotation_OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('drop TextAnnotation_Global -> Participant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanDrop('TextAnnotation_Global', 'Participant', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
|
|
|
|
describe('message flows', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.messageFlow.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('drop MessageFlow -> Collaboration', inject(function() {
|
|
|
|
|
|
|
|
expectCanDrop('MessageFlow', 'Collaboration', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2016-01-21 14:15:21 +00:00
|
|
|
describe('data association move', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.dataAssociation.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('mode selection including data association', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
elementRegistry.get('Task'),
|
|
|
|
elementRegistry.get('DataAssociation'),
|
|
|
|
elementRegistry.get('DataObjectReference')
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'Process', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
describe('event move', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach/move BoundaryEvent -> Process', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
|
|
|
|
|
|
var elements = [ boundaryEvent ];
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove(elements, 'Process_1', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach/move BoundaryEvent -> Task', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
|
|
|
|
|
|
var elements = [ boundaryEvent ];
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove(elements, 'Task_2', {
|
|
|
|
attach: 'attach',
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach/move BoundaryEvent label -> SubProcess', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
label = boundaryEvent.label;
|
|
|
|
|
|
|
|
var elements = [ label ];
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove(elements, 'SubProcess_1', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function (elementRegistry) {
|
|
|
|
// when
|
|
|
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
|
|
|
|
|
|
|
|
// we assume boundary events and labels
|
|
|
|
// to be already filtered during move
|
|
|
|
var elements = [ boundaryEvent, boundaryEvent2 ];
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove(elements, 'SubProcess_1', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function (elementRegistry) {
|
|
|
|
// when
|
|
|
|
var subProcess = elementRegistry.get('SubProcess_1'),
|
|
|
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
label = boundaryEvent.label;
|
|
|
|
|
|
|
|
// we assume boundary events and labels
|
|
|
|
// to be already filtered during move
|
|
|
|
var elements = [ subProcess, boundaryEvent, label ];
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove(elements, 'Process_1', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event create', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
it('attach IntermediateEvent to Task', inject(function(elementFactory) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove([ eventShape ], 'Task_1', {
|
|
|
|
attach: 'attach',
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
it('not attach IntermediateEvent to CompensationTask', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove([ eventShape ], 'CompensationTask', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-08-06 07:40:58 +00:00
|
|
|
it('attach IntermediateEvent to SubProcess inner', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 350
|
|
|
|
});
|
|
|
|
|
|
|
|
var position = {
|
2015-08-06 07:40:58 +00:00
|
|
|
x: subProcessElement.x + subProcessElement.width / 2,
|
|
|
|
y: subProcessElement.y + subProcessElement.height / 2
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
|
|
|
|
|
|
|
|
// then
|
2015-08-11 12:46:17 +00:00
|
|
|
expect(canAttach).to.be.false;
|
2015-08-06 07:40:58 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('attach IntermediateEvent to SubProcess border', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 0, y: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
var position = {
|
|
|
|
x: subProcessElement.x + subProcessElement.width / 2,
|
|
|
|
y: subProcessElement.y + subProcessElement.height
|
2015-07-13 08:37:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canAttach).to.equal('attach');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
it('not attach IntermediateEvent to compensation activity', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var compensationTask = elementRegistry.get('CompensationTask');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 0, y: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
var position = {
|
|
|
|
x: compensationTask.x + compensationTask.width / 2,
|
|
|
|
y: compensationTask.y + compensationTask.height
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], compensationTask, null, position);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
it('create IntermediateEvent in SubProcess body', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
var position = {
|
|
|
|
x: eventShape.x,
|
|
|
|
y: eventShape.y
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position),
|
|
|
|
canCreate = bpmnRules.canCreate(eventShape, subProcessElement, null, position);
|
|
|
|
|
|
|
|
// then
|
2015-08-11 12:46:17 +00:00
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
expect(canCreate).to.be.true;
|
2015-07-13 08:37:43 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event append', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('append IntermediateEvent from Task', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1'),
|
|
|
|
taskElement = elementRegistry.get('Task_2');
|
|
|
|
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
var position = {
|
|
|
|
x: eventShape.x,
|
|
|
|
y: eventShape.y
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, taskElement, position),
|
|
|
|
canCreate = bpmnRules.canCreate(eventShape, subProcessElement, taskElement, position);
|
|
|
|
|
|
|
|
// then
|
2015-08-11 12:46:17 +00:00
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
expect(canCreate).to.be.true;
|
2015-07-13 08:37:43 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('append IntermediateEvent from BoundaryEvent', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var boundaryElement = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
taskElement = elementRegistry.get('Task_2');
|
|
|
|
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach([ eventShape ], taskElement, boundaryElement),
|
|
|
|
canCreate = bpmnRules.canCreate(eventShape, taskElement, boundaryElement);
|
|
|
|
|
|
|
|
// then
|
2015-08-11 12:46:17 +00:00
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
expect(canCreate).to.be.false;
|
2015-07-13 08:37:43 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
describe('lanes', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collaboration-lanes.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
describe('should add', function() {
|
|
|
|
|
|
|
|
it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, participantElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Lane -> Participant_Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant_Lane');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, participantElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('[not] Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, subProcessElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
describe('should not allow move', function() {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ laneElement ], participantElement);
|
|
|
|
|
|
|
|
// then
|
2015-10-09 23:42:09 +00:00
|
|
|
expect(canMove).to.be.false;
|
2015-08-11 12:46:17 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
it('Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ laneElement ], subProcessElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should resize', function() {
|
|
|
|
|
2015-08-21 11:58:23 +00:00
|
|
|
it('Lane', inject(function(bpmnRules, elementRegistry) {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canResize = bpmnRules.canResize(laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canResize).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should allow drop', function() {
|
|
|
|
|
|
|
|
it('SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var element = elementRegistry.get('SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ element ], laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Task_in_SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var element = elementRegistry.get('Task_in_SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ element ], laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
});
|