test(modeling): verify attachment is not unnecessarily moved

Related to https://github.com/camunda/camunda-modeler/issues/1737
This commit is contained in:
Maciej Barelkowski 2020-03-27 13:57:54 +01:00 committed by fake-join[bot]
parent b9d237e300
commit aa58493872
2 changed files with 63 additions and 23 deletions

View File

@ -1,5 +1,5 @@
<?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="_tkxkICCPEeWwcL3w8i7dvw" targetNamespace="http://activiti.org/bpmn" exporter="camunda modeler" exporterVersion="2.7.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="_tkxkICCPEeWwcL3w8i7dvw" targetNamespace="http://activiti.org/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:subProcess id="SubProcess_1">
<bpmn2:startEvent id="StartEvent_1">
@ -15,43 +15,32 @@
<bpmn2:boundaryEvent id="BoundaryEvent_2" name="superman" attachedToRef="Task_2" />
<bpmn2:task id="CompensationTask" isForCompensation="true" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1" name="joker" />
<bpmn2:boundaryEvent id="BoundaryEvent_3" name="wonder woman" attachedToRef="SubProcess_1" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_2" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds x="204" y="78" width="457" height="289" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_2" targetElement="_BPMNShape_Task_2">
<di:waypoint x="311" y="232" />
<di:waypoint x="431" y="232" />
<bpmndi:BPMNLabel>
<dc:Bounds x="332" y="236" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="275" y="214" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="293" y="255" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_2" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds x="204" y="78" width="457" height="289" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
<dc:Bounds x="431" y="192" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_2" targetElement="_BPMNShape_Task_2">
<di:waypoint xsi:type="dc:Point" x="311" y="232" />
<di:waypoint xsi:type="dc:Point" x="431" y="232" />
<bpmndi:BPMNLabel>
<dc:Bounds x="332" y="236" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
<dc:Bounds x="185" y="349" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="155" y="390" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
<dc:Bounds x="795" y="75" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEvent_2_di" bpmnElement="BoundaryEvent_2">
<dc:Bounds x="781" y="140" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="754" y="176" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CompensationTask_di" bpmnElement="CompensationTask">
<dc:Bounds x="795" y="249" width="100" height="80" />
</bpmndi:BPMNShape>
@ -61,6 +50,24 @@
<dc:Bounds x="191" y="525" width="24" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEvent_2_di" bpmnElement="BoundaryEvent_2">
<dc:Bounds x="781" y="140" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="754" y="176" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
<dc:Bounds x="185" y="349" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="155" y="390" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1kn7msk_di" bpmnElement="BoundaryEvent_3">
<dc:Bounds x="412" y="349" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="393" y="392" width="75" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -3,6 +3,8 @@ import {
inject
} from 'test/TestHelper';
import { pick } from 'min-dash';
import {
getBusinessObject
} from 'lib/util/ModelUtil';
@ -123,4 +125,35 @@ describe('features/modeling - resize shape', function() {
});
describe('integration', function() {
var diagramXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
it('should not move Boundary Event if unnecessary', inject(function(elementRegistry, modeling) {
// given
var boundaryEvent = elementRegistry.get('BoundaryEvent_3'),
originalPosition = getPosition(boundaryEvent),
subProcessElement = elementRegistry.get('SubProcess_1');
// when
modeling.resizeShape(subProcessElement, { x: 204, y: 28, width: 400, height: 339 });
// then
expect(getPosition(boundaryEvent)).to.jsonEqual(originalPosition);
}));
});
});
// helper /////
function getPosition(shape) {
return pick(shape, [ 'x', 'y' ]);
}