mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-22 23:08:49 +00:00
feat(modeling/layout): improve MessageFlow layout on SubProcesses
Related to #574
This commit is contained in:
parent
6549af7aca
commit
fcf2bbd9aa
@ -9,6 +9,8 @@ var BaseLayouter = require('diagram-js/lib/layout/BaseLayouter'),
|
||||
|
||||
var LayoutUtil = require('diagram-js/lib/layout/LayoutUtil');
|
||||
|
||||
var isExpanded = require('../../util/DiUtil').isExpanded;
|
||||
|
||||
var getMid = LayoutUtil.getMid,
|
||||
getOrientation = LayoutUtil.getOrientation;
|
||||
|
||||
@ -35,7 +37,7 @@ BpmnLayouter.prototype.layoutConnection = function(connection, layoutHints) {
|
||||
start = getConnectionDocking(waypoints, 0, source);
|
||||
end = getConnectionDocking(waypoints, waypoints && waypoints.length - 1, target);
|
||||
|
||||
// TODO (nre): support vertical modeling
|
||||
// TODO(nikku): support vertical modeling
|
||||
// and invert preferredLayouts accordingly
|
||||
|
||||
if (is(connection, 'bpmn:Association') ||
|
||||
@ -58,10 +60,23 @@ BpmnLayouter.prototype.layoutConnection = function(connection, layoutHints) {
|
||||
};
|
||||
}
|
||||
|
||||
if (isExpandedSubProcess(target)) {
|
||||
manhattanOptions = {
|
||||
preferredLayouts: [ 'straight', 'v:v' ]
|
||||
};
|
||||
}
|
||||
|
||||
if (isExpandedSubProcess(source) && is(target, 'bpmn:FlowNode')) {
|
||||
manhattanOptions = {
|
||||
preferredLayouts: [ 'straight', 'v:v' ],
|
||||
preserveDocking: isExpandedSubProcess(target) ? 'source' : 'target'
|
||||
};
|
||||
}
|
||||
|
||||
if (is(source, 'bpmn:Participant') && is(target, 'bpmn:FlowNode')) {
|
||||
manhattanOptions = {
|
||||
preferredLayouts: [ 'straight', 'v:v' ],
|
||||
moveSource: true
|
||||
preserveDocking: 'target'
|
||||
};
|
||||
}
|
||||
|
||||
@ -164,3 +179,8 @@ function isCompensationAssociation(connection) {
|
||||
is(source, 'bpmn:BoundaryEvent') &&
|
||||
target.businessObject.isForCompensation;
|
||||
}
|
||||
|
||||
|
||||
function isExpandedSubProcess(element) {
|
||||
return is(element, 'bpmn:SubProcess') && isExpanded(element);
|
||||
}
|
@ -1,93 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pHDz0KojEeOJhIBv1RySdg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.1.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
|
||||
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pHDz0KojEeOJhIBv1RySdg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.2.0-nightly" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
|
||||
<bpmn2:collaboration id="_Collaboration_2">
|
||||
<bpmn2:participant id="Participant_2" name="Pool" processRef="Process_1" />
|
||||
<bpmn2:participant id="Participant_1" name="Pool" processRef="Process_2" />
|
||||
<bpmn2:messageFlow id="MessageFlow_1" name="" sourceRef="Task_2" targetRef="Participant_1" />
|
||||
<bpmn2:messageFlow id="MessageFlow_2" name="" sourceRef="Participant_1" targetRef="Participant_2" />
|
||||
<bpmn2:messageFlow id="MessageFlow_4" name="" sourceRef="Task_1" targetRef="StartEvent_1" />
|
||||
<bpmn2:messageFlow id="MessageFlow_5" name="" sourceRef="EndEvent_1" targetRef="Participant_1" />
|
||||
<bpmn2:messageFlow id="MessageFlow_6" sourceRef="Participant_1" targetRef="Task_3" />
|
||||
<bpmn2:participant id="Participant_A" name="A" processRef="Process_A" />
|
||||
<bpmn2:participant id="Participant_B" name="B" processRef="Process_B" />
|
||||
<bpmn2:messageFlow id="MessageFlow_1" name="1" sourceRef="Task_B" targetRef="Participant_B" />
|
||||
<bpmn2:messageFlow id="MessageFlow_2" name="2" sourceRef="Participant_B" targetRef="Participant_A" />
|
||||
<bpmn2:messageFlow id="MessageFlow_3" name="3" sourceRef="SubProcess_E" targetRef="SubProcess_G" />
|
||||
<bpmn2:messageFlow id="MessageFlow_4" name="4" sourceRef="Task_A" targetRef="StartEvent_F" />
|
||||
<bpmn2:messageFlow id="MessageFlow_5" name="5" sourceRef="EndEvent_C" targetRef="Participant_B" />
|
||||
<bpmn2:messageFlow id="MessageFlow_6" name="6" sourceRef="Participant_B" targetRef="Task_D" />
|
||||
<bpmn2:messageFlow id="MessageFlow_7" name="7" sourceRef="SubProcess_G" targetRef="Task_D" />
|
||||
</bpmn2:collaboration>
|
||||
<bpmn2:process id="Process_1" isExecutable="false">
|
||||
<bpmn2:task id="Task_1" />
|
||||
<bpmn2:endEvent id="EndEvent_1">
|
||||
<bpmn2:process id="Process_A" isExecutable="false">
|
||||
<bpmn2:task id="Task_A" name="A" />
|
||||
<bpmn2:endEvent id="EndEvent_C" name="C">
|
||||
<bpmn2:messageEventDefinition id="MessageEventDefinition_2" />
|
||||
</bpmn2:endEvent>
|
||||
<bpmn2:task id="Task_2" />
|
||||
<bpmn2:task id="Task_3" />
|
||||
<bpmn2:task id="Task_B" name="B" />
|
||||
<bpmn2:task id="Task_D" name="D" />
|
||||
<bpmn2:subProcess id="SubProcess_E" name="E" />
|
||||
</bpmn2:process>
|
||||
<bpmn2:process id="Process_2" isExecutable="false">
|
||||
<bpmn2:startEvent id="StartEvent_1">
|
||||
<bpmn2:process id="Process_B" isExecutable="false">
|
||||
<bpmn2:subProcess id="SubProcess_G" name="G" />
|
||||
<bpmn2:startEvent id="StartEvent_F" name="F">
|
||||
<bpmn2:messageEventDefinition id="MessageEventDefinition_1" />
|
||||
</bpmn2:startEvent>
|
||||
</bpmn2:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2">
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
|
||||
<dc:Bounds x="278" y="84" width="599" height="217" />
|
||||
<bpmndi:BPMNShape id="Participant_A_di" bpmnElement="Participant_A" isHorizontal="true">
|
||||
<dc:Bounds x="278" y="64" width="823" height="237" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant_1" isHorizontal="true">
|
||||
<dc:Bounds x="222" y="415" width="600" height="100" />
|
||||
<bpmndi:BPMNShape id="Participant_B_di" bpmnElement="Participant_B" isHorizontal="true">
|
||||
<dc:Bounds x="222" y="415" width="600" height="185" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEvent_1">
|
||||
<bpmndi:BPMNShape id="StartEvent_F_di" bpmnElement="StartEvent_F">
|
||||
<dc:Bounds x="300" y="448" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="273" y="489" width="90" height="0" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_1">
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Task_D" bpmnElement="Task_A">
|
||||
<dc:Bounds x="360" y="134" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1" sourceElement="_BPMNShape_Task_4" targetElement="_BPMNShape_Participant_3">
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1" sourceElement="_BPMNShape_Task_4" targetElement="Participant_B_di">
|
||||
<di:waypoint xsi:type="dc:Point" x="590" y="214" />
|
||||
<di:waypoint xsi:type="dc:Point" x="590" y="415" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="522" y="314" width="6" height="6" />
|
||||
<dc:Bounds x="555" y="320" width="90" height="6" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_2" bpmnElement="MessageFlow_2" sourceElement="_BPMNShape_Participant_3" targetElement="_BPMNShape_Participant_2">
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_2" bpmnElement="MessageFlow_2" sourceElement="Participant_B_di" targetElement="Participant_A_di">
|
||||
<di:waypoint xsi:type="dc:Point" x="506" y="415" />
|
||||
<di:waypoint xsi:type="dc:Point" x="506" y="301" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="504" y="386" width="6" height="6" />
|
||||
<dc:Bounds x="477" y="356" width="90" height="6" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_4" bpmnElement="MessageFlow_4" sourceElement="_BPMNShape_Task_3" targetElement="_BPMNShape_StartEvent_3">
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_4" bpmnElement="MessageFlow_4" sourceElement="_BPMNShape_Task_D" targetElement="StartEvent_F_di">
|
||||
<di:waypoint xsi:type="dc:Point" x="390" y="214" />
|
||||
<di:waypoint xsi:type="dc:Point" x="390" y="387" />
|
||||
<di:waypoint xsi:type="dc:Point" x="318" y="387" />
|
||||
<di:waypoint xsi:type="dc:Point" x="318" y="448" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="427" y="321" width="6" height="6" />
|
||||
<dc:Bounds x="361" y="321" width="90" height="6" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
|
||||
<bpmndi:BPMNShape id="EndEvent_C_di" bpmnElement="EndEvent_C">
|
||||
<dc:Bounds x="653" y="178" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="671" y="219" width="0" height="0" />
|
||||
<dc:Bounds x="626" y="154" width="90" height="0" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_5" bpmnElement="MessageFlow_5" sourceElement="_BPMNShape_EndEvent_2" targetElement="_BPMNShape_Participant_3">
|
||||
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_5" bpmnElement="MessageFlow_5" sourceElement="EndEvent_C_di" targetElement="Participant_B_di">
|
||||
<di:waypoint xsi:type="dc:Point" x="671" y="214" />
|
||||
<di:waypoint xsi:type="dc:Point" x="671" y="415" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="630" y="332" width="6" height="6" />
|
||||
<dc:Bounds x="636" y="314" width="90" height="6" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Task_4" bpmnElement="Task_2">
|
||||
<bpmndi:BPMNShape id="_BPMNShape_Task_4" bpmnElement="Task_B">
|
||||
<dc:Bounds x="516" y="134" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Task_01g27j8_di" bpmnElement="Task_3">
|
||||
<bpmndi:BPMNShape id="Task_D_di" bpmnElement="Task_D">
|
||||
<dc:Bounds x="723" y="134" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="MessageFlow_0dz36ij_di" bpmnElement="MessageFlow_6">
|
||||
<bpmndi:BPMNEdge id="MessageFlow_6_di" bpmnElement="MessageFlow_6">
|
||||
<di:waypoint xsi:type="dc:Point" x="773" y="415" />
|
||||
<di:waypoint xsi:type="dc:Point" x="773" y="214" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="743" y="304.5" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="SubProcess_E_di" bpmnElement="SubProcess_E" isExpanded="true">
|
||||
<dc:Bounds x="855" y="135" width="184" height="131" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="SubProcess_G_di" bpmnElement="SubProcess_G" isExpanded="true">
|
||||
<dc:Bounds x="566" y="458" width="212" height="122" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="MessageFlow_7_di" bpmnElement="MessageFlow_7">
|
||||
<di:waypoint xsi:type="dc:Point" x="752" y="458" />
|
||||
<di:waypoint xsi:type="dc:Point" x="752" y="214" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="698" y="318" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="MessageFlow_3_di" bpmnElement="MessageFlow_3">
|
||||
<di:waypoint xsi:type="dc:Point" x="902" y="266" />
|
||||
<di:waypoint xsi:type="dc:Point" x="902" y="362" />
|
||||
<di:waypoint xsi:type="dc:Point" x="708" y="362" />
|
||||
<di:waypoint xsi:type="dc:Point" x="708" y="458" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="814" y="340" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn2:definitions>
|
||||
|
@ -21,7 +21,7 @@ describe('features/modeling - layout message flows', function() {
|
||||
it('should layout manhattan after Task move', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
var taskShape = elementRegistry.get('Task_A'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_4');
|
||||
|
||||
// when
|
||||
@ -29,7 +29,7 @@ describe('features/modeling - layout message flows', function() {
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ original: { x: 420, y: 234 }, x: 420, y: 234 },
|
||||
{ x: 420, y: 387 },
|
||||
{ x: 318, y: 387 },
|
||||
@ -38,29 +38,31 @@ describe('features/modeling - layout message flows', function() {
|
||||
}));
|
||||
|
||||
|
||||
it('should layout straight after Task move', inject(function(elementRegistry, modeling) {
|
||||
it('should layout Task -> Participant straight after Task move',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_2'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_1');
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_1');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ taskShape ], { x: 20, y: -20 });
|
||||
// when
|
||||
modeling.moveElements([ taskShape ], { x: 20, y: -20 });
|
||||
|
||||
// then
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
{ original: { x: 610, y: 194 }, x: 610, y: 194 },
|
||||
{ original: { x: 610, y: 415 }, x: 610, y: 415 }
|
||||
]);
|
||||
}));
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ original: { x: 610, y: 194 }, x: 610, y: 194 },
|
||||
{ original: { x: 610, y: 415 }, x: 610, y: 415 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should layout straight after Participant move', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_1'),
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_5');
|
||||
|
||||
// when
|
||||
@ -69,52 +71,26 @@ describe('features/modeling - layout message flows', function() {
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
|
||||
{ original: { x: 671, y: 465 }, x: 671, y: 465 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
||||
it('should layout straight after Participant move, without moving Task\'s docking point',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_1'),
|
||||
messageFlow1 = elementRegistry.get('MessageFlow_1'),
|
||||
messageFlow6 = elementRegistry.get('MessageFlow_6');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: 300, y: 50 });
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlow1.waypoints).eql([
|
||||
{ original: { x: 590, y: 214 }, x: 590, y: 214 },
|
||||
{ original: { x: 590, y: 465 }, x: 590, y: 465 }
|
||||
]);
|
||||
|
||||
expect(messageFlow6.waypoints).eql([
|
||||
{ original: { x: 773, y: 465 }, x: 773, y: 465 },
|
||||
{ original: { x: 773, y: 214 }, x: 773, y: 214 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
||||
it('should layout manhattan after Participant move beyond EndEvent bounds',
|
||||
it('should layout EndEvent -> Participant manhattan',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_1'),
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_5');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: -200, y: 0 });
|
||||
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
|
||||
{ x: 671, y: 315 },
|
||||
{ x: 471, y: 315 },
|
||||
@ -123,4 +99,215 @@ describe('features/modeling - layout message flows', function() {
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should layout SubProcess -> SubProcess (straight) on SubProcess move',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_G'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_3');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ subProcessShape ], { x: 300, y: 0 });
|
||||
|
||||
// then
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 902, y: 266 }, { x: 902, y: 458 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
describe('should keep task docking', function() {
|
||||
|
||||
describe('on SubProcess resize', function() {
|
||||
|
||||
it('SubProcess -> Task (straight)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_G'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_7');
|
||||
|
||||
// when
|
||||
modeling.resizeShape(subProcessShape, {
|
||||
x: 586,
|
||||
y: 458,
|
||||
width: 212,
|
||||
height: 122
|
||||
});
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 752, y: 458 },
|
||||
{ x: 752, y: 214 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
describe('on SubProcess move', function() {
|
||||
|
||||
it('SubProcess -> Task (straight)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_G'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_7');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ subProcessShape ], { x: 50, y: 0 });
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 752, y: 458 },
|
||||
{ x: 752, y: 214 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
describe('on Participant move', function() {
|
||||
|
||||
it('Task -> Participant (straight)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection_1 = elementRegistry.get('MessageFlow_1'),
|
||||
messageFlowConnection_6 = elementRegistry.get('MessageFlow_6');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: 300, y: 50 });
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection_1).to.have.waypoints([
|
||||
{ original: { x: 590, y: 214 }, x: 590, y: 214 },
|
||||
{ original: { x: 590, y: 465 }, x: 590, y: 465 }
|
||||
]);
|
||||
|
||||
expect(messageFlowConnection_6).to.have.waypoints([
|
||||
{ original: { x: 773, y: 465 }, x: 773, y: 465 },
|
||||
{ original: { x: 773, y: 214 }, x: 773, y: 214 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('on Participant resize', function() {
|
||||
|
||||
it('Task -> Participant (straight)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_1');
|
||||
|
||||
// when
|
||||
modeling.resizeShape(participantShape, {
|
||||
x: 222,
|
||||
y: 415,
|
||||
width: 580,
|
||||
height: 185
|
||||
});
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 590, y: 214 },
|
||||
{ x: 590, y: 415 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('Participant -> Task (straight)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_6');
|
||||
|
||||
// when
|
||||
modeling.resizeShape(participantShape, {
|
||||
x: 222,
|
||||
y: 415,
|
||||
width: 580,
|
||||
height: 185
|
||||
});
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 773, y: 415 },
|
||||
{ x: 773, y: 214 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('Task -> Participant (manhattan)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_1');
|
||||
|
||||
// when
|
||||
modeling.resizeShape(participantShape, {
|
||||
x: 622,
|
||||
y: 415,
|
||||
width: 600,
|
||||
height: 185
|
||||
});
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 590, y: 214 },
|
||||
{ x: 590, y: 315 },
|
||||
{ x: 990, y: 315 },
|
||||
{ x: 990, y: 415 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('Participant -> Task (manhattan)',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_B'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_6');
|
||||
|
||||
// when
|
||||
modeling.resizeShape(participantShape, {
|
||||
x: 222,
|
||||
y: 415,
|
||||
width: 500,
|
||||
height: 185
|
||||
});
|
||||
|
||||
// then
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection).to.have.waypoints([
|
||||
{ x: 681, y: 415 },
|
||||
{ x: 681, y: 315 },
|
||||
{ x: 773, y: 315 },
|
||||
{ x: 773, y: 214 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user