style(tests): reformat DropOnFlowBehaviorSpec

This commit is contained in:
Nico Rehwaldt 2018-02-14 22:20:11 +01:00
parent f5afc732fe
commit de63fd49a3
1 changed files with 191 additions and 152 deletions

View File

@ -17,19 +17,27 @@ describe('modeling/behavior - drop on connection', function() {
var diagramXML = require('./DropOnFlowBehavior.bpmn');
var testModules = [ noTouchInteractionModule, moveModule, modelingModule, coreModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
beforeEach(bootstrapModeler(diagramXML, {
modules: [
noTouchInteractionModule,
moveModule,
modelingModule,
coreModule
]
}));
describe('execution', function() {
describe('create', function() {
it('should connect start -> target -> end', inject(function(modeling, elementRegistry, elementFactory) {
it('should connect start -> target -> end', inject(
function(modeling, elementRegistry, elementFactory) {
// given
var intermediateThrowEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
var intermediateThrowEvent = elementFactory.createShape({
type: 'bpmn:IntermediateThrowEvent'
});
var startEvent = elementRegistry.get('StartEvent'),
sequenceFlow = elementRegistry.get('SequenceFlow_1'),
@ -40,7 +48,11 @@ describe('modeling/behavior - drop on connection', function() {
var dropPosition = { x: 340, y: 120 }; // first bendpoint
// when
var newShape = modeling.createShape(intermediateThrowEvent, dropPosition, sequenceFlow);
var newShape = modeling.createShape(
intermediateThrowEvent,
dropPosition,
sequenceFlow
);
// then
@ -72,10 +84,12 @@ describe('modeling/behavior - drop on connection', function() {
]));
expect(targetConnection).to.have.startDocking(dropPosition);
}));
}
));
it('should connect start -> target', inject(function(modeling, elementRegistry, elementFactory) {
it('should connect start -> target', inject(
function(modeling, elementRegistry, elementFactory) {
// given
var endEventShape = elementFactory.createShape({ type: 'bpmn:EndEvent' });
@ -86,7 +100,11 @@ describe('modeling/behavior - drop on connection', function() {
var dropPosition = { x: 340, y: 120 }; // first bendpoint
// when
var newShape = modeling.createShape(endEventShape, dropPosition, sequenceFlow);
var newShape = modeling.createShape(
endEventShape,
dropPosition,
sequenceFlow
);
// then
@ -102,13 +120,17 @@ describe('modeling/behavior - drop on connection', function() {
originalWaypoints.slice(0, 1),
{ x: 322, y: 120 }
]));
}));
}
));
it('should connect target -> end', inject(function(modeling, elementRegistry, elementFactory) {
it('should connect target -> end', inject(
function(modeling, elementRegistry, elementFactory) {
// given
var startEventShape = elementFactory.createShape({ type: 'bpmn:StartEvent' });
var startEventShape = elementFactory.createShape({
type: 'bpmn:StartEvent'
});
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
var originalWaypoints = sequenceFlow.waypoints;
@ -116,7 +138,11 @@ describe('modeling/behavior - drop on connection', function() {
var dropPosition = { x: 340, y: 120 }; // first bendpoint
// when
var newShape = modeling.createShape(startEventShape, dropPosition, sequenceFlow);
var newShape = modeling.createShape(
startEventShape,
dropPosition,
sequenceFlow
);
// then
@ -132,7 +158,8 @@ describe('modeling/behavior - drop on connection', function() {
{ x: 340, y: 138 },
originalWaypoints.slice(2)
]));
}));
}
));
it('should connect start -> target -> end (with bendpointBefore inside bbox)', inject(
@ -191,7 +218,8 @@ describe('modeling/behavior - drop on connection', function() {
dragging.setOptions({ manual: true });
}));
it('should connect start -> target -> end', inject(function(dragging, move, elementRegistry, selection) {
it('should connect start -> target -> end', inject(
function(dragging, move, elementRegistry, selection) {
// given
var intermediateThrowEvent = elementRegistry.get('IntermediateThrowEvent_foo');
@ -246,7 +274,8 @@ describe('modeling/behavior - drop on connection', function() {
]));
expect(targetConnection).to.have.startDocking({ x: 341, y: 210 });
}));
}
));
it('should connect start -> target -> end (hovering parent)', inject(
@ -498,7 +527,8 @@ describe('modeling/behavior - drop on connection', function() {
));
it('should not insert on inaccuratly found intersection', inject(function(dragging, move, elementRegistry, selection) {
it('should not insert on inaccuratly found intersection', inject(
function(dragging, move, elementRegistry, selection) {
// given
var intermediateThrowEvent = elementRegistry.get('IntermediateThrowEvent_foo');
@ -523,7 +553,8 @@ describe('modeling/behavior - drop on connection', function() {
// then
expect(intermediateThrowEvent.incoming).to.have.lengthOf(0);
expect(intermediateThrowEvent.outgoing).to.have.lengthOf(0);
}));
}
));
});
@ -532,22 +563,28 @@ describe('modeling/behavior - drop on connection', function() {
describe('rules', function() {
it('should be allowed for an IntermediateThrowEvent', inject(function(elementRegistry, bpmnRules, elementFactory) {
it('should be allowed for an IntermediateThrowEvent', inject(
function(elementRegistry, bpmnRules, elementFactory) {
// when
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
var intermediateThrowEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
var intermediateThrowEvent = elementFactory.createShape({
type: 'bpmn:IntermediateThrowEvent'
});
// then
expect(bpmnRules.canCreate(intermediateThrowEvent, sequenceFlow)).to.be.true;
}));
}
));
it('should not insert participant', inject(
function(rules, elementRegistry, elementFactory) {
// given
var participantShape = elementFactory.createShape({ type: 'bpmn:Participant' });
var participantShape = elementFactory.createShape({
type: 'bpmn:Participant'
});
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
@ -606,7 +643,8 @@ describe('modeling/behavior - drop on connection', function() {
));
it('should not insert on sequence flow label', inject(function(bpmnRules, elementRegistry) {
it('should not insert on sequence flow label', inject(
function(bpmnRules, elementRegistry) {
// given
var eventShape = elementRegistry.get('IntermediateThrowEvent_foo'),
@ -619,7 +657,8 @@ describe('modeling/behavior - drop on connection', function() {
// then
expect(canInsert).to.be.false;
}));
}
));
});