test(modeling): add test for center-to-center connection

Relates to #1087
This commit is contained in:
Niklas Kiefer 2019-06-19 12:13:48 +02:00 committed by merge-me[bot]
parent 9b9ff934d2
commit 827df52e4b
2 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="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="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:task id="Task_1">
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
</bpmn:task>
<bpmn:task id="Task_2">
<bpmn:incoming>SequenceFlow_1</bpmn:incoming>
</bpmn:task>
<bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="Task_1" targetRef="Task_2" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
<dc:Bounds x="150" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
<dc:Bounds x="300" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
<di:waypoint x="250" y="120" />
<di:waypoint x="300" y="120" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -221,6 +221,41 @@ describe('features/modeling - move elements', function() {
}));
});
describe('center-to-center connection', function() {
var diagramXML = require('./MoveElements.centered-connection.bpmn');
beforeEach(bootstrapModeler(diagramXML, {
modules: [
coreModule,
modelingModule
]
}));
it('should properly adjust connection', inject(function(elementRegistry, modeling) {
// given
var targetElement = elementRegistry.get('Task_2');
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
// move from centric-left to centric-below
var delta = { x: -150, y: 150 };
var expectedWaypoints = [
{ x: 200, y: 160 },
{ x: 200, y: 230 }
];
// when
modeling.moveElements([ targetElement ], delta);
// then
expect(sequenceFlow).to.have.waypoints(expectedWaypoints);
}));
});
});