test(modeling): ensure reconnecting data association works

Closes #1008
This commit is contained in:
Maciej Barelkowski 2019-06-06 16:15:54 +02:00 committed by merge-me[bot]
parent aa62eb27f8
commit debb96f49d
2 changed files with 59 additions and 5 deletions

View File

@ -4,8 +4,15 @@
<bpmn2:participant id="Participant_1" name="Pool" processRef="Process_1"/> <bpmn2:participant id="Participant_1" name="Pool" processRef="Process_1"/>
</bpmn2:collaboration> </bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false"> <bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:textAnnotation id="TextAnnotation_1"/> <bpmn2:task id="Task">
<bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="Participant_1"/> <bpmn2:dataOutputAssociation id="DataOutputAssociation">
<bpmn2:targetRef>DataObjectReference</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:dataObjectReference id="DataObjectReference" dataObjectRef="DataObject_12volar" />
<bpmn2:dataObject id="DataObject_12volar" />
<bpmn2:textAnnotation id="TextAnnotation_1" />
<bpmn2:association id="Association_1" sourceRef="TextAnnotation_1" targetRef="Participant_1" />
</bpmn2:process> </bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_3"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_3">
@ -16,8 +23,18 @@
<dc:Bounds height="105.0" width="133.0" x="708.0" y="72.0"/> <dc:Bounds height="105.0" width="133.0" x="708.0" y="72.0"/>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_TextAnnotation_2" targetElement="_BPMNShape_Participant_3"> <bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_TextAnnotation_2" targetElement="_BPMNShape_Participant_3">
<di:waypoint xsi:type="dc:Point" x="708.0" y="136.0"/> <di:waypoint x="708" y="136" />
<di:waypoint xsi:type="dc:Point" x="612.0" y="153.0"/> <di:waypoint x="612" y="153" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Task_di" bpmnElement="Task">
<dc:Bounds x="302" y="162" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_di" bpmnElement="DataObjectReference">
<dc:Bounds x="449" y="177" width="36" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="DataOutputAssociation_di" bpmnElement="DataOutputAssociation">
<di:waypoint x="402" y="202" />
<di:waypoint x="449" y="202" />
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>

View File

@ -271,7 +271,7 @@ describe('features/modeling - replace connection', function() {
}); });
describe('should replace SequenceFlow <> MessageFlow', function() { describe('text/data association', function() {
var processDiagramXML = require('./ReplaceConnectionBehavior.association.bpmn'); var processDiagramXML = require('./ReplaceConnectionBehavior.association.bpmn');
@ -324,6 +324,43 @@ describe('features/modeling - replace connection', function() {
}); });
describe('reconnecting data output association to text annotation', function() {
it('execute', inject(function(modeling) {
// given
var textAnnotation = element('TextAnnotation_1'),
dataObjectReference = element('DataObjectReference'),
dataOutputAssociation = element('DataOutputAssociation');
// when
modeling.reconnectStart(dataOutputAssociation, textAnnotation, { x: 708, y: 100 });
// then
expectConnected(textAnnotation, dataObjectReference, 'bpmn:Association');
}));
it('undo', inject(function(modeling, commandStack) {
// given
var task = element('Task'),
dataObjectReference = element('DataObjectReference'),
textAnnotation = element('TextAnnotation_1'),
dataOutputAssociation = element('DataOutputAssociation');
modeling.reconnectStart(dataOutputAssociation, textAnnotation, { x: 708, y: 100 });
// when
commandStack.undo();
// then
expectConnected(task, dataObjectReference, dataOutputAssociation);
}));
});
}); });