mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00:00
fix(modeling): use correct parent for bpmn:TextAnnotation
This commit is contained in:
parent
a5ed6aa9db
commit
e387768ef1
@ -89,7 +89,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||||||
append(element, 'bpmn:IntermediateThrowEvent');
|
append(element, 'bpmn:IntermediateThrowEvent');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'action.model-text-Annotation': {
|
'action.model-text-annotation': {
|
||||||
group: 'model',
|
group: 'model',
|
||||||
className: 'icon-text-annotation',
|
className: 'icon-text-annotation',
|
||||||
action: function() {
|
action: function() {
|
||||||
|
@ -157,15 +157,52 @@ BpmnUpdater.prototype.updateDiParent = function(di, parentDi) {
|
|||||||
|
|
||||||
BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent) {
|
BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent) {
|
||||||
|
|
||||||
|
var containment;
|
||||||
|
|
||||||
if (businessObject.$parent === newParent) {
|
if (businessObject.$parent === newParent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (businessObject.$instanceOf('bpmn:FlowElement')) {
|
||||||
|
|
||||||
|
if (businessObject.$parent === newParent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newParent && newParent.$instanceOf('bpmn:Participant')) {
|
||||||
|
newParent = newParent.processRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
containment = 'flowElements';
|
||||||
|
} else
|
||||||
|
|
||||||
|
if (businessObject.$instanceOf('bpmn:Artifact')) {
|
||||||
|
|
||||||
|
while (newParent &&
|
||||||
|
!newParent.$instanceOf('bpmn:Process') &&
|
||||||
|
!newParent.$instanceOf('bpmn:SubProcess') &&
|
||||||
|
!newParent.$instanceOf('bpmn:Collaboration')) {
|
||||||
|
|
||||||
|
if (newParent.$instanceOf('bpmn:Participant')) {
|
||||||
|
newParent = newParent.processRef;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
newParent = newParent.$parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
containment = 'artifacts';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!containment) {
|
||||||
|
throw new Error('no parent for ', businessObject, newParent);
|
||||||
|
}
|
||||||
|
|
||||||
var children;
|
var children;
|
||||||
|
|
||||||
if (businessObject.$parent) {
|
if (businessObject.$parent) {
|
||||||
// remove from old parent
|
// remove from old parent
|
||||||
children = businessObject.$parent.get('flowElements');
|
children = businessObject.$parent.get(containment);
|
||||||
Collections.remove(children, businessObject);
|
Collections.remove(children, businessObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +210,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent)
|
|||||||
businessObject.$parent = null;
|
businessObject.$parent = null;
|
||||||
} else {
|
} else {
|
||||||
// add to new parent
|
// add to new parent
|
||||||
children = newParent.get('flowElements');
|
children = newParent.get(containment);
|
||||||
children.push(businessObject);
|
children.push(businessObject);
|
||||||
businessObject.$parent = newParent;
|
businessObject.$parent = newParent;
|
||||||
}
|
}
|
||||||
|
129
test/fixtures/bpmn/containers.bpmn
vendored
Normal file
129
test/fixtures/bpmn/containers.bpmn
vendored
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_okVDYHb5EeS4-aNScj8yqQ" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
|
||||||
|
<bpmn2:collaboration id="_Collaboration_2">
|
||||||
|
<bpmn2:participant id="_Participant_2" name="Pool" processRef="Process_1"/>
|
||||||
|
<bpmn2:participant id="Participant_1" name="Participant_1" processRef="Process_2"/>
|
||||||
|
<bpmn2:participant id="Participant_2" name="Participant_2" processRef="Process_3"/>
|
||||||
|
</bpmn2:collaboration>
|
||||||
|
<bpmn2:process id="Process_1" isExecutable="false">
|
||||||
|
<bpmn2:laneSet id="LaneSet_1" name="Lane Set 1">
|
||||||
|
<bpmn2:lane id="Lane_1" name="Lane_1">
|
||||||
|
<bpmn2:childLaneSet xsi:type="bpmn2:tLaneSet" id="LaneSet_3">
|
||||||
|
<bpmn2:lane id="Lane_3" name="Lane_3">
|
||||||
|
<bpmn2:flowNodeRef>SubProcess_1</bpmn2:flowNodeRef>
|
||||||
|
<bpmn2:flowNodeRef>Transaction_1</bpmn2:flowNodeRef>
|
||||||
|
</bpmn2:lane>
|
||||||
|
<bpmn2:lane id="Lane_4" name="Lane_4">
|
||||||
|
<bpmn2:flowNodeRef>SubProcess_2</bpmn2:flowNodeRef>
|
||||||
|
<bpmn2:flowNodeRef>IntermediateThrowEvent_4</bpmn2:flowNodeRef>
|
||||||
|
</bpmn2:lane>
|
||||||
|
</bpmn2:childLaneSet>
|
||||||
|
</bpmn2:lane>
|
||||||
|
</bpmn2:laneSet>
|
||||||
|
<bpmn2:subProcess id="SubProcess_1" name="SubProcess_1">
|
||||||
|
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_3"/>
|
||||||
|
</bpmn2:subProcess>
|
||||||
|
<bpmn2:transaction id="Transaction_1" name="Transaction_1">
|
||||||
|
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_2"/>
|
||||||
|
</bpmn2:transaction>
|
||||||
|
<bpmn2:subProcess id="SubProcess_2" name="SubProcess_2">
|
||||||
|
<bpmn2:transaction id="Transaction_2" name="Transaction_2">
|
||||||
|
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1"/>
|
||||||
|
</bpmn2:transaction>
|
||||||
|
</bpmn2:subProcess>
|
||||||
|
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_4"/>
|
||||||
|
</bpmn2:process>
|
||||||
|
<bpmn2:process id="Process_2" isExecutable="false">
|
||||||
|
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1"/>
|
||||||
|
</bpmn2:process>
|
||||||
|
<bpmn2:process id="Process_3" isExecutable="false">
|
||||||
|
<bpmn2:laneSet id="LaneSet_2" name="Lane Set 2">
|
||||||
|
<bpmn2:lane id="Lane_2" name="Lane_2">
|
||||||
|
<bpmn2:flowNodeRef>IntermediateCatchEvent_2</bpmn2:flowNodeRef>
|
||||||
|
</bpmn2:lane>
|
||||||
|
</bpmn2:laneSet>
|
||||||
|
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_2"/>
|
||||||
|
<bpmn2:textAnnotation id="TextAnnotation_2"/>
|
||||||
|
<bpmn2:association id="Association_2" sourceRef="TextAnnotation_2" targetRef="IntermediateCatchEvent_2"/>
|
||||||
|
</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 height="361.0" width="697.0" x="24.0" y="17.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant_1" isHorizontal="true">
|
||||||
|
<dc:Bounds height="181.0" width="457.0" x="744.0" y="0.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_2" bpmnElement="IntermediateCatchEvent_1">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="804.0" y="120.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="822.0" y="161.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Lane_2" bpmnElement="Lane_1" isHorizontal="true">
|
||||||
|
<dc:Bounds height="361.0" width="667.0" x="54.0" y="17.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Participant_4" bpmnElement="Participant_2" isHorizontal="true">
|
||||||
|
<dc:Bounds height="169.0" width="457.0" x="744.0" y="209.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_3" bpmnElement="IntermediateCatchEvent_2">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="804.0" y="317.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="822.0" y="358.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_2" bpmnElement="SubProcess_1" isExpanded="true">
|
||||||
|
<dc:Bounds height="150.0" width="200.0" x="132.0" y="33.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Lane_3" bpmnElement="Lane_2" isHorizontal="true">
|
||||||
|
<dc:Bounds height="169.0" width="427.0" x="774.0" y="209.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Lane_4" bpmnElement="Lane_3" isHorizontal="true">
|
||||||
|
<dc:Bounds height="181.0" width="637.0" x="84.0" y="17.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Lane_5" bpmnElement="Lane_4" isHorizontal="true">
|
||||||
|
<dc:Bounds height="181.0" width="637.0" x="84.0" y="197.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Transaction_2" bpmnElement="Transaction_1" isExpanded="true">
|
||||||
|
<dc:Bounds height="150.0" width="200.0" x="372.0" y="33.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_3" bpmnElement="SubProcess_2" isExpanded="true">
|
||||||
|
<dc:Bounds height="150.0" width="200.0" x="132.0" y="213.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Transaction_3" bpmnElement="Transaction_2" isExpanded="true">
|
||||||
|
<dc:Bounds height="107.0" width="145.0" x="144.0" y="240.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_2" bpmnElement="IntermediateThrowEvent_1">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="170.0" y="287.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="188.0" y="328.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_3" bpmnElement="IntermediateThrowEvent_2">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="396.0" y="125.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="414.0" y="166.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_4" bpmnElement="IntermediateThrowEvent_3">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="168.0" y="125.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="186.0" y="166.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_5" bpmnElement="IntermediateThrowEvent_4">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="396.0" y="286.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="414.0" y="327.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_3" bpmnElement="TextAnnotation_2">
|
||||||
|
<dc:Bounds height="50.0" width="50.0" x="893.0" y="247.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_Association_2" bpmnElement="Association_2" sourceElement="_BPMNShape_TextAnnotation_3" targetElement="_BPMNShape_IntermediateCatchEvent_3">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="893.0" y="288.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="840.0" y="323.0"/>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn2:definitions>
|
119
test/fixtures/bpmn/nested-subprocesses.bpmn
vendored
Normal file
119
test/fixtures/bpmn/nested-subprocesses.bpmn
vendored
Normal file
@ -0,0 +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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_ywazMDK5EeScr6nb_20jUA" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
|
||||||
|
<bpmn2:process id="Process_1" isExecutable="false">
|
||||||
|
<bpmn2:subProcess id="SubProcess_1">
|
||||||
|
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
|
||||||
|
<bpmn2:subProcess id="SubProcess_2">
|
||||||
|
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
|
||||||
|
<bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
|
||||||
|
<bpmn2:startEvent id="StartEvent_1">
|
||||||
|
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
|
||||||
|
</bpmn2:startEvent>
|
||||||
|
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEvent_1" targetRef="UserTask_1"/>
|
||||||
|
<bpmn2:userTask id="UserTask_1">
|
||||||
|
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
|
||||||
|
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
|
||||||
|
</bpmn2:userTask>
|
||||||
|
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="UserTask_1" targetRef="EndEvent_1"/>
|
||||||
|
<bpmn2:endEvent id="EndEvent_1">
|
||||||
|
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
|
||||||
|
</bpmn2:endEvent>
|
||||||
|
</bpmn2:subProcess>
|
||||||
|
<bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="SubProcess_2" targetRef="ExclusiveGateway_1"/>
|
||||||
|
<bpmn2:startEvent id="StartEvent_3">
|
||||||
|
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
|
||||||
|
</bpmn2:startEvent>
|
||||||
|
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_3" targetRef="SubProcess_2"/>
|
||||||
|
<bpmn2:exclusiveGateway id="ExclusiveGateway_1">
|
||||||
|
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
|
||||||
|
</bpmn2:exclusiveGateway>
|
||||||
|
</bpmn2:subProcess>
|
||||||
|
<bpmn2:startEvent id="StartEvent_2">
|
||||||
|
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
|
||||||
|
</bpmn2:startEvent>
|
||||||
|
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_2" targetRef="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 height="349.0" width="841.0" x="168.0" y="144.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_3" bpmnElement="SubProcess_2" isExpanded="true">
|
||||||
|
<dc:Bounds height="301.0" width="517.0" x="336.0" y="168.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_8" bpmnElement="StartEvent_1">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="415.0" y="288.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="433.0" y="329.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_9" bpmnElement="StartEvent_2">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="26.0" y="224.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_9" targetElement="_BPMNShape_SubProcess_2">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="62.0" y="242.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="115.0" y="242.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="115.0" y="318.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="168.0" y="318.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="6.0" width="6.0" x="112.0" y="264.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_UserTask_3" bpmnElement="UserTask_1">
|
||||||
|
<dc:Bounds height="80.0" width="100.0" x="564.0" y="238.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_8" targetElement="_BPMNShape_UserTask_3">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="433.0" y="324.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="433.0" y="415.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="614.0" y="415.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="614.0" y="318.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="6.0" width="6.0" x="430.0" y="349.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_24" bpmnElement="EndEvent_1">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="696.0" y="348.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="714.0" y="389.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_UserTask_3" targetElement="_BPMNShape_EndEvent_24">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="664.0" y="278.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="794.0" y="278.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="794.0" y="366.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="732.0" y="366.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="6.0" width="6.0" x="686.0" y="278.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_10" bpmnElement="StartEvent_3">
|
||||||
|
<dc:Bounds height="36.0" width="36.0" x="216.0" y="216.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="234.0" y="257.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_10" targetElement="_BPMNShape_SubProcess_3">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="252.0" y="234.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="294.0" y="234.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="294.0" y="318.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="336.0" y="318.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="6.0" width="6.0" x="291.0" y="245.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_2" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
|
||||||
|
<dc:Bounds height="50.0" width="50.0" x="936.0" y="201.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="0.0" width="0.0" x="961.0" y="256.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_SubProcess_3" targetElement="_BPMNShape_ExclusiveGateway_2">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="852.0" y="253.0"/>
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="936.0" y="232.0"/>
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds height="6.0" width="6.0" x="915.0" y="236.0"/>
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn2:definitions>
|
@ -348,58 +348,6 @@ describe('features/modeling - append shape', function() {
|
|||||||
|
|
||||||
describe('bpmn element support', function() {
|
describe('bpmn element support', function() {
|
||||||
|
|
||||||
describe('TextAnnotation', function() {
|
|
||||||
|
|
||||||
it('should wire connection source + target', inject(function(elementRegistry, modeling) {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
|
||||||
|
|
||||||
// when
|
|
||||||
var targetShape = modeling.appendTextAnnotation(startEventShape, 'bpmn:TextAnnotation'),
|
|
||||||
target = targetShape.businessObject;
|
|
||||||
|
|
||||||
var connectingConnection = _.find(targetShape.incoming, function(c) {
|
|
||||||
return c.target === targetShape;
|
|
||||||
});
|
|
||||||
|
|
||||||
var connecting = connectingConnection.businessObject;
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(targetShape).toBeDefined();
|
|
||||||
expect(target.$instanceOf('bpmn:TextAnnotation')).toBe(true);
|
|
||||||
|
|
||||||
expect(connecting.$instanceOf('bpmn:Association')).toBe(true);
|
|
||||||
expect(connecting.sourceRef).toBe(startEventShape.businessObject);
|
|
||||||
expect(connecting.targetRef).toBe(target);
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
it('should undo wire connection source + target', inject(function(elementRegistry, modeling, commandStack) {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
|
||||||
|
|
||||||
var targetShape = modeling.appendTextAnnotation(startEventShape, 'bpmn:TextAnnotation'),
|
|
||||||
target = targetShape.businessObject;
|
|
||||||
|
|
||||||
var connectingConnection = _.find(targetShape.incoming, function(c) {
|
|
||||||
return c.target === targetShape;
|
|
||||||
});
|
|
||||||
|
|
||||||
var connecting = connectingConnection.businessObject;
|
|
||||||
|
|
||||||
// when
|
|
||||||
commandStack.undo();
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(connecting.sourceRef).toBe(null);
|
|
||||||
expect(connecting.targetRef).toBe(null);
|
|
||||||
}));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
describe('ExclusiveGateway', function() {
|
describe('ExclusiveGateway', function() {
|
||||||
|
|
||||||
it('should append', inject(function(elementRegistry, modeling) {
|
it('should append', inject(function(elementRegistry, modeling) {
|
||||||
|
131
test/spec/features/modeling/append/TextAnnotationSpec.js
Normal file
131
test/spec/features/modeling/append/TextAnnotationSpec.js
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Matchers = require('../../../../Matchers'),
|
||||||
|
TestHelper = require('../../../../TestHelper');
|
||||||
|
|
||||||
|
/* global bootstrapModeler, inject */
|
||||||
|
|
||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var modelingModule = require('../../../../../lib/features/modeling'),
|
||||||
|
coreModule = require('../../../../../lib/core');
|
||||||
|
|
||||||
|
|
||||||
|
var LabelUtil = require('../../../../../lib/util/Label');
|
||||||
|
|
||||||
|
|
||||||
|
ddescribe('features/modeling - append text-annotation', function() {
|
||||||
|
|
||||||
|
beforeEach(Matchers.addDeepEquals);
|
||||||
|
|
||||||
|
|
||||||
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/containers.bpmn', 'utf8');
|
||||||
|
|
||||||
|
var testModules = [ coreModule, modelingModule ];
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
|
|
||||||
|
describe('should append', function() {
|
||||||
|
|
||||||
|
it('in lane');
|
||||||
|
|
||||||
|
it('in participant', inject(function(elementRegistry, modeling) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var eventShape = elementRegistry.get('IntermediateCatchEvent_1'),
|
||||||
|
process = elementRegistry.get('Participant_1').businessObject.processRef;
|
||||||
|
|
||||||
|
// when
|
||||||
|
var annotationShape = modeling.appendTextAnnotation(eventShape, 'bpmn:TextAnnotation'),
|
||||||
|
annotation = annotationShape.businessObject;
|
||||||
|
|
||||||
|
var connectingConnection = _.find(annotationShape.incoming, function(c) {
|
||||||
|
return c.target === annotationShape;
|
||||||
|
});
|
||||||
|
|
||||||
|
var connecting = connectingConnection.businessObject;
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(annotationShape).toBeDefined();
|
||||||
|
expect(annotation.$instanceOf('bpmn:TextAnnotation')).toBe(true);
|
||||||
|
|
||||||
|
expect(connecting.$instanceOf('bpmn:Association')).toBe(true);
|
||||||
|
expect(connecting.sourceRef).toBe(eventShape.businessObject);
|
||||||
|
expect(connecting.targetRef).toBe(annotation);
|
||||||
|
|
||||||
|
// correctly assign artifact parent
|
||||||
|
expect(annotation.$parent).toBe(process);
|
||||||
|
expect(connecting.$parent).toBe(process);
|
||||||
|
|
||||||
|
expect(process.artifacts).toContain(annotation);
|
||||||
|
expect(process.artifacts).toContain(connecting);
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('in sub process', inject(function(elementRegistry, modeling) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var eventShape = elementRegistry.get('IntermediateThrowEvent_1');
|
||||||
|
|
||||||
|
// when
|
||||||
|
var annotationShape = modeling.appendTextAnnotation(eventShape, 'bpmn:TextAnnotation'),
|
||||||
|
annotation = annotationShape.businessObject;
|
||||||
|
|
||||||
|
var connectingConnection = _.find(annotationShape.incoming, function(c) {
|
||||||
|
return c.target === annotationShape;
|
||||||
|
});
|
||||||
|
|
||||||
|
var connecting = connectingConnection.businessObject;
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(annotationShape).toBeDefined();
|
||||||
|
expect(annotation.$instanceOf('bpmn:TextAnnotation')).toBe(true);
|
||||||
|
|
||||||
|
expect(connecting.$instanceOf('bpmn:Association')).toBe(true);
|
||||||
|
expect(connecting.sourceRef).toBe(eventShape.businessObject);
|
||||||
|
expect(connecting.targetRef).toBe(annotation);
|
||||||
|
|
||||||
|
// correctly assign artifact parent
|
||||||
|
expect(annotation.$parent.id).toBe('Transaction_2');
|
||||||
|
expect(connecting.$parent.id).toBe('Transaction_2');
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('undo', function() {
|
||||||
|
|
||||||
|
it('should undo wire connection source + target', inject(function(elementRegistry, modeling, commandStack) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var eventShape = elementRegistry.get('IntermediateCatchEvent_1'),
|
||||||
|
process = elementRegistry.get('Participant_1').businessObject.processRef;
|
||||||
|
|
||||||
|
var annotationShape = modeling.appendTextAnnotation(eventShape, 'bpmn:TextAnnotation'),
|
||||||
|
annotation = annotationShape.businessObject;
|
||||||
|
|
||||||
|
var connectingConnection = _.find(annotationShape.incoming, function(c) {
|
||||||
|
return c.target === annotationShape;
|
||||||
|
});
|
||||||
|
|
||||||
|
var connecting = connectingConnection.businessObject;
|
||||||
|
|
||||||
|
// when
|
||||||
|
commandStack.undo();
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(connecting.sourceRef).toBe(null);
|
||||||
|
expect(connecting.targetRef).toBe(null);
|
||||||
|
expect(connecting.$parent).toBe(null);
|
||||||
|
expect(process.artifacts).not.toContain(connecting);
|
||||||
|
|
||||||
|
expect(annotation.$parent).toBe(null);
|
||||||
|
expect(process.artifacts).not.toContain(annotation);
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user