bpmn-js 0.20.4 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.travis.yml +2 -0
  2. package/lib/draw/BpmnRenderer.js +4 -3
  3. package/lib/features/copy-paste/BpmnCopyPaste.js +22 -19
  4. package/lib/features/label-editing/LabelEditingPreview.js +122 -0
  5. package/lib/features/label-editing/LabelEditingProvider.js +154 -55
  6. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +10 -6
  7. package/lib/features/label-editing/index.js +8 -3
  8. package/lib/features/modeling/BpmnUpdater.js +17 -13
  9. package/lib/features/modeling/ElementFactory.js +36 -19
  10. package/lib/features/modeling/Modeling.js +5 -1
  11. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +50 -16
  12. package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +4 -2
  13. package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +3 -2
  14. package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +36 -30
  15. package/lib/features/rules/BpmnRules.js +29 -11
  16. package/lib/features/snapping/BpmnSnapping.js +22 -6
  17. package/package.json +22 -22
  18. package/test/TestHelper.js +1 -1
  19. package/test/fixtures/bpmn/features/label-editing/labels.bpmn +132 -202
  20. package/test/integration/CustomElementsSpec.js +2 -5
  21. package/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +38 -0
  22. package/test/spec/features/label-editing/LabelEditingPreviewSpec.js +133 -0
  23. package/test/spec/features/label-editing/LabelEditingProviderSpec.js +207 -172
  24. package/test/spec/features/modeling/LabelBoundsSpec.js +3 -1
  25. package/test/spec/features/modeling/LabelLayoutingSpec.js +211 -232
  26. package/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn +5 -1
  27. package/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +174 -1
  28. package/test/spec/features/modeling/behavior/util/LabelLayoutUtilSpec.js +75 -0
  29. package/test/spec/features/modeling/behavior/util/LineAttachmentUtilSpec.js +55 -7
  30. package/test/spec/features/rules/BpmnRulesSpec.js +108 -64
  31. package/test/spec/features/snapping/BpmnSnapping.sequenceFlow.bpmn +41 -0
  32. package/test/spec/features/snapping/BpmnSnappingSpec.js +66 -0
@@ -1,248 +1,178 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <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="_w9Yc0PLSEeOqh_cnoUOA7A" targetNamespace="http://activiti.org/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0-nightly" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
3
- <bpmn2:collaboration id="_Collaboration_2">
4
- <bpmn2:participant id="expanded-pool" name="A" processRef="Process_1" />
5
- <bpmn2:participant id="collapsed-pool" name="A" />
6
- <bpmn2:messageFlow id="message-flow" name="A" sourceRef="task-nested-embedded" targetRef="collapsed-pool" />
7
- <bpmn2:messageFlow id="message-flow-unlabeled" name="" sourceRef="collapsed-pool" targetRef="expanded-pool" />
8
- <bpmn2:textAnnotation id="text-annotation"> <bpmn2:text>A</bpmn2:text>
9
- </bpmn2:textAnnotation>
10
- </bpmn2:collaboration>
11
- <bpmn2:process id="Process_1" isExecutable="false">
12
- <bpmn2:ioSpecification id="InputOutputSpecification_1">
13
- <bpmn2:dataInput id="data-input" />
14
- <bpmn2:dataOutput id="data-output" />
15
- </bpmn2:ioSpecification>
16
- <bpmn2:laneSet id="LaneSet_1" name="Lane Set 1">
17
- <bpmn2:lane id="lane-1" name="A">
18
- <bpmn2:flowNodeRef>intermediate-throw-event</bpmn2:flowNodeRef>
19
- <bpmn2:flowNodeRef>empty-task</bpmn2:flowNodeRef>
20
- <bpmn2:childLaneSet xsi:type="bpmn2:tLaneSet" id="LaneSet_2">
21
- <bpmn2:lane id="nested-lane-1-1" name="A">
22
- <bpmn2:flowNodeRef>start-event</bpmn2:flowNodeRef>
23
- <bpmn2:flowNodeRef>exclusive-gateway</bpmn2:flowNodeRef>
24
- <bpmn2:flowNodeRef>intermediate-throw-event</bpmn2:flowNodeRef>
25
- <bpmn2:flowNodeRef>empty-task</bpmn2:flowNodeRef>
26
- </bpmn2:lane>
27
- <bpmn2:lane id="nested-lane-1-2" name="A">
28
- <bpmn2:flowNodeRef>call-activity</bpmn2:flowNodeRef>
29
- <bpmn2:flowNodeRef>user-task</bpmn2:flowNodeRef>
30
- </bpmn2:lane>
31
- </bpmn2:childLaneSet>
32
- </bpmn2:lane>
33
- <bpmn2:lane id="lane-2" name="A">
34
- <bpmn2:childLaneSet xsi:type="bpmn2:tLaneSet" id="LaneSet_3">
35
- <bpmn2:lane id="nested-lane-no-label" name="">
36
- <bpmn2:flowNodeRef>subprocess-expanded</bpmn2:flowNodeRef>
37
- <bpmn2:flowNodeRef>subprocess-collapsed</bpmn2:flowNodeRef>
38
- </bpmn2:lane>
39
- </bpmn2:childLaneSet>
40
- </bpmn2:lane>
41
- </bpmn2:laneSet>
42
- <bpmn2:subProcess id="subprocess-expanded" name="A">
43
- <bpmn2:dataInputAssociation id="DataInputAssociation_1">
44
- <bpmn2:sourceRef>data-input</bpmn2:sourceRef>
45
- </bpmn2:dataInputAssociation>
46
- <bpmn2:dataOutputAssociation id="DataOutputAssociation_1">
47
- <bpmn2:targetRef>data-output</bpmn2:targetRef>
48
- </bpmn2:dataOutputAssociation>
49
- <bpmn2:task id="task-nested-embedded" name="A" />
50
- </bpmn2:subProcess>
51
- <bpmn2:subProcess id="subprocess-collapsed" name="A" triggeredByEvent="true">
52
- <bpmn2:dataInputAssociation id="DataInputAssociation_2">
53
- <bpmn2:sourceRef>data-store-reference</bpmn2:sourceRef>
54
- </bpmn2:dataInputAssociation>
55
- <bpmn2:startEvent id="nested-embedded-start-event" name="start event" isInterrupting="false" />
56
- </bpmn2:subProcess>
57
- <bpmn2:callActivity id="call-activity" name="A">
58
- <bpmn2:incoming>sequence-flow-no</bpmn2:incoming>
59
- </bpmn2:callActivity>
60
- <bpmn2:userTask id="user-task" name="A" />
61
- <bpmn2:boundaryEvent id="boundary-event" name="A" attachedToRef="user-task" />
62
- <bpmn2:startEvent id="start-event">
63
- <bpmn2:outgoing>sequenceflow-unlabeled</bpmn2:outgoing>
64
- </bpmn2:startEvent>
65
- <bpmn2:sequenceFlow id="sequenceflow-unlabeled" name="" sourceRef="start-event" targetRef="exclusive-gateway" />
66
- <bpmn2:exclusiveGateway id="exclusive-gateway" name="A">
67
- <bpmn2:incoming>sequenceflow-unlabeled</bpmn2:incoming>
68
- <bpmn2:outgoing>sequence-flow-no</bpmn2:outgoing>
69
- <bpmn2:outgoing>sequence-flow-yes</bpmn2:outgoing>
70
- </bpmn2:exclusiveGateway>
71
- <bpmn2:sequenceFlow id="sequence-flow-no" name="A" sourceRef="exclusive-gateway" targetRef="call-activity" />
72
- <bpmn2:sequenceFlow id="sequence-flow-yes" name="A" sourceRef="exclusive-gateway" targetRef="intermediate-throw-event" />
73
- <bpmn2:dataStoreReference id="data-store-reference" name="A" dataStoreRef="DataStore_1" />
74
- <bpmn2:dataObject id="DataObject_1" name="Data Object 1" />
75
- <bpmn2:dataObjectReference id="data-object-reference" name="A" dataObjectRef="DataObject_1" />
76
- <bpmn2:intermediateThrowEvent id="intermediate-throw-event" name="A">
77
- <bpmn2:incoming>sequence-flow-yes</bpmn2:incoming>
78
- <bpmn2:outgoing>SequenceFlow_1r751z0</bpmn2:outgoing>
79
- </bpmn2:intermediateThrowEvent>
80
- <bpmn2:task id="empty-task">
81
- <bpmn2:incoming>SequenceFlow_1r751z0</bpmn2:incoming>
82
- </bpmn2:task>
83
- <bpmn2:sequenceFlow id="SequenceFlow_1r751z0" sourceRef="intermediate-throw-event" targetRef="empty-task" />
84
- <bpmn2:association id="Association_1" sourceRef="text-annotation" targetRef="subprocess-expanded" />
85
- </bpmn2:process>
86
- <bpmn2:dataStore id="DataStore_1" name="Data Store 1" />
2
+ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.6.0">
3
+ <bpmn:collaboration id="Collaboration_1o0amh9">
4
+ <bpmn:participant id="Participant_1" name="FOO BAR" processRef="Process_1" />
5
+ <bpmn:participant id="Participant_2" />
6
+ <bpmn:messageFlow id="MessageFlow_1" name="FOO" sourceRef="Task_1fo1fvh" targetRef="Participant_2" />
7
+ <bpmn:textAnnotation id="TextAnnotation_1"> <bpmn:text>FOO</bpmn:text>
8
+ </bpmn:textAnnotation>
9
+ </bpmn:collaboration>
10
+ <bpmn:process id="Process_1" isExecutable="false">
11
+ <bpmn:laneSet>
12
+ <bpmn:lane id="Lane_2">
13
+ <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
14
+ <bpmn:flowNodeRef>SubProcess_1</bpmn:flowNodeRef>
15
+ </bpmn:lane>
16
+ <bpmn:lane id="Lane_1" name="FOO BAR">
17
+ <bpmn:flowNodeRef>Task_1</bpmn:flowNodeRef>
18
+ <bpmn:flowNodeRef>StartEvent_08jn2xd</bpmn:flowNodeRef>
19
+ <bpmn:flowNodeRef>Task_1fo1fvh</bpmn:flowNodeRef>
20
+ <bpmn:flowNodeRef>ExclusiveGateway_1</bpmn:flowNodeRef>
21
+ <bpmn:flowNodeRef>EndEvent_1</bpmn:flowNodeRef>
22
+ </bpmn:lane>
23
+ </bpmn:laneSet>
24
+ <bpmn:startEvent id="StartEvent_1" name="FOO">
25
+ <bpmn:outgoing>SequenceFlow_2</bpmn:outgoing>
26
+ </bpmn:startEvent>
27
+ <bpmn:sequenceFlow id="SequenceFlow_2" sourceRef="StartEvent_1" targetRef="SubProcess_1" />
28
+ <bpmn:subProcess id="SubProcess_1" name="FOO">
29
+ <bpmn:incoming>SequenceFlow_2</bpmn:incoming>
30
+ <bpmn:outgoing>SequenceFlow_14kuv1e</bpmn:outgoing>
31
+ </bpmn:subProcess>
32
+ <bpmn:startEvent id="StartEvent_08jn2xd" name="FOO&#10;BAR">
33
+ <bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
34
+ </bpmn:startEvent>
35
+ <bpmn:task id="Task_1" name="FOO">
36
+ <bpmn:incoming>SequenceFlow_1</bpmn:incoming>
37
+ <bpmn:incoming>SequenceFlow_14kuv1e</bpmn:incoming>
38
+ <bpmn:outgoing>SequenceFlow_13rjp44</bpmn:outgoing>
39
+ <bpmn:outgoing>SequenceFlow_0kmqqm9</bpmn:outgoing>
40
+ </bpmn:task>
41
+ <bpmn:sequenceFlow id="SequenceFlow_1" name="FOO" sourceRef="StartEvent_08jn2xd" targetRef="Task_1" />
42
+ <bpmn:sequenceFlow id="SequenceFlow_14kuv1e" sourceRef="SubProcess_1" targetRef="Task_1" />
43
+ <bpmn:task id="Task_1fo1fvh" name="FOO&#10;BAR">
44
+ <bpmn:incoming>SequenceFlow_13rjp44</bpmn:incoming>
45
+ <bpmn:outgoing>SequenceFlow_1h7vuvi</bpmn:outgoing>
46
+ </bpmn:task>
47
+ <bpmn:sequenceFlow id="SequenceFlow_13rjp44" sourceRef="Task_1" targetRef="Task_1fo1fvh" />
48
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1" name="FOO">
49
+ <bpmn:incoming>SequenceFlow_1h7vuvi</bpmn:incoming>
50
+ </bpmn:exclusiveGateway>
51
+ <bpmn:sequenceFlow id="SequenceFlow_1h7vuvi" sourceRef="Task_1fo1fvh" targetRef="ExclusiveGateway_1" />
52
+ <bpmn:endEvent id="EndEvent_1">
53
+ <bpmn:incoming>SequenceFlow_0kmqqm9</bpmn:incoming>
54
+ </bpmn:endEvent>
55
+ <bpmn:sequenceFlow id="SequenceFlow_0kmqqm9" sourceRef="Task_1" targetRef="EndEvent_1" />
56
+ <bpmn:dataObjectReference id="DataObjectReference_1" dataObjectRef="DataObject_1rq8hb8" />
57
+ <bpmn:dataObject id="DataObject_1rq8hb8" />
58
+ <bpmn:dataStoreReference id="DataStoreReference_1" />
59
+ <bpmn:association id="Association_0ckvfj2" sourceRef="SubProcess_1" targetRef="TextAnnotation_1" />
60
+ </bpmn:process>
87
61
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
88
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2">
89
- <bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="expanded-pool" isHorizontal="true">
90
- <dc:Bounds x="60" y="48" width="540" height="613" />
62
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1o0amh9">
63
+ <bpmndi:BPMNShape id="Participant_15tkgjw_di" bpmnElement="Participant_1">
64
+ <dc:Bounds x="160" y="122" width="600" height="477" />
91
65
  </bpmndi:BPMNShape>
92
- <bpmndi:BPMNShape id="_BPMNShape_Lane_2" bpmnElement="lane-1" isHorizontal="true">
93
- <dc:Bounds x="90" y="48" width="510" height="277" />
66
+ <bpmndi:BPMNShape id="Lane_00fz5ca_di" bpmnElement="Lane_2">
67
+ <dc:Bounds x="190" y="122" width="570" height="250" />
94
68
  </bpmndi:BPMNShape>
95
- <bpmndi:BPMNShape id="_BPMNShape_Lane_3" bpmnElement="nested-lane-1-1" isHorizontal="true">
96
- <dc:Bounds x="120" y="48" width="480" height="133" />
69
+ <bpmndi:BPMNShape id="Lane_1qi2aws_di" bpmnElement="Lane_1">
70
+ <dc:Bounds x="190" y="372" width="570" height="227" />
97
71
  </bpmndi:BPMNShape>
98
- <bpmndi:BPMNShape id="_BPMNShape_Lane_4" bpmnElement="nested-lane-1-2" isHorizontal="true">
99
- <dc:Bounds x="120" y="180" width="480" height="145" />
72
+ <bpmndi:BPMNShape id="SubProcess_194zznr_di" bpmnElement="SubProcess_1" isExpanded="true">
73
+ <dc:Bounds x="311" y="147" width="350" height="200" />
100
74
  </bpmndi:BPMNShape>
101
- <bpmndi:BPMNShape id="_BPMNShape_Lane_5" bpmnElement="lane-2" isHorizontal="true">
102
- <dc:Bounds x="90" y="324" width="510" height="337" />
103
- </bpmndi:BPMNShape>
104
- <bpmndi:BPMNShape id="_BPMNShape_Lane_6" bpmnElement="nested-lane-no-label" isHorizontal="true">
105
- <dc:Bounds x="120" y="324" width="480" height="337" />
106
- </bpmndi:BPMNShape>
107
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_2" bpmnElement="subprocess-expanded" isExpanded="true">
108
- <dc:Bounds x="359" y="364" width="200" height="150" />
109
- </bpmndi:BPMNShape>
110
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_3" bpmnElement="subprocess-collapsed">
111
- <dc:Bounds x="156" y="364" width="100" height="80" />
112
- </bpmndi:BPMNShape>
113
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="nested-embedded-start-event">
114
- <dc:Bounds x="188" y="386" width="36" height="36" />
75
+ <bpmndi:BPMNShape id="StartEvent_0909sti_di" bpmnElement="StartEvent_1">
76
+ <dc:Bounds x="223" y="229" width="36" height="36" />
115
77
  <bpmndi:BPMNLabel>
116
- <dc:Bounds x="173" y="427" width="66" height="22" />
78
+ <dc:Bounds x="228" y="265" width="25" height="12" />
117
79
  </bpmndi:BPMNLabel>
118
80
  </bpmndi:BPMNShape>
119
- <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="task-nested-embedded">
120
- <dc:Bounds x="432" y="408" width="100" height="80" />
121
- </bpmndi:BPMNShape>
122
- <bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="collapsed-pool" isHorizontal="true">
123
- <dc:Bounds x="672" y="336" width="385" height="100" />
124
- </bpmndi:BPMNShape>
125
- <bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_2" bpmnElement="text-annotation">
126
- <dc:Bounds x="60" y="669" width="147" height="98" />
127
- </bpmndi:BPMNShape>
128
- <bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_TextAnnotation_2" targetElement="_BPMNShape_SubProcess_2">
129
- <di:waypoint xsi:type="dc:Point" x="190" y="669" />
130
- <di:waypoint xsi:type="dc:Point" x="371" y="514" />
131
- </bpmndi:BPMNEdge>
132
- <bpmndi:BPMNShape id="_BPMNShape_CallActivity_2" bpmnElement="call-activity">
133
- <dc:Bounds x="422" y="202" width="100" height="80" />
134
- </bpmndi:BPMNShape>
135
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="start-event">
136
- <dc:Bounds x="168" y="96" width="36" height="36" />
81
+ <bpmndi:BPMNEdge id="SequenceFlow_140ewlr_di" bpmnElement="SequenceFlow_2">
82
+ <di:waypoint xsi:type="dc:Point" x="259" y="247" />
83
+ <di:waypoint xsi:type="dc:Point" x="311" y="247" />
137
84
  <bpmndi:BPMNLabel>
138
- <dc:Bounds x="153" y="137" width="66" height="22" />
85
+ <dc:Bounds x="285" y="232" width="0" height="0" />
139
86
  </bpmndi:BPMNLabel>
87
+ </bpmndi:BPMNEdge>
88
+ <bpmndi:BPMNShape id="TextAnnotation_0vwfagl_di" bpmnElement="TextAnnotation_1">
89
+ <dc:Bounds x="814" y="122" width="100" height="30" />
140
90
  </bpmndi:BPMNShape>
141
- <bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_2" bpmnElement="intermediate-throw-event">
142
- <dc:Bounds x="397" y="96" width="36" height="36" />
91
+ <bpmndi:BPMNEdge id="Association_0ckvfj2_di" bpmnElement="Association_0ckvfj2">
92
+ <di:waypoint xsi:type="dc:Point" x="661" y="196" />
93
+ <di:waypoint xsi:type="dc:Point" x="814" y="152" />
94
+ </bpmndi:BPMNEdge>
95
+ <bpmndi:BPMNShape id="StartEvent_08jn2xd_di" bpmnElement="StartEvent_08jn2xd">
96
+ <dc:Bounds x="223" y="416" width="36" height="36" />
143
97
  <bpmndi:BPMNLabel>
144
- <dc:Bounds x="371" y="137" width="90" height="38" />
98
+ <dc:Bounds x="228" y="452" width="25" height="24" />
145
99
  </bpmndi:BPMNLabel>
146
100
  </bpmndi:BPMNShape>
147
- <bpmndi:BPMNShape id="_BPMNShape_UserTask_2" bpmnElement="user-task">
148
- <dc:Bounds x="180" y="192" width="100" height="80" />
149
- </bpmndi:BPMNShape>
150
- <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_2" bpmnElement="boundary-event">
151
- <dc:Bounds x="228" y="254" width="36" height="36" />
152
- <bpmndi:BPMNLabel>
153
- <dc:Bounds x="200" y="295" width="93" height="22" />
154
- </bpmndi:BPMNLabel>
101
+ <bpmndi:BPMNShape id="Task_1i068gk_di" bpmnElement="Task_1">
102
+ <dc:Bounds x="436" y="394" width="100" height="80" />
155
103
  </bpmndi:BPMNShape>
156
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_2" bpmnElement="exclusive-gateway" isMarkerVisible="true">
157
- <dc:Bounds x="312" y="89" width="50" height="50" />
104
+ <bpmndi:BPMNEdge id="SequenceFlow_088kva8_di" bpmnElement="SequenceFlow_1">
105
+ <di:waypoint xsi:type="dc:Point" x="259" y="434" />
106
+ <di:waypoint xsi:type="dc:Point" x="436" y="434" />
158
107
  <bpmndi:BPMNLabel>
159
- <dc:Bounds x="306" y="48" width="64" height="38" />
108
+ <dc:Bounds x="335" y="409" width="25" height="12" />
160
109
  </bpmndi:BPMNLabel>
161
- </bpmndi:BPMNShape>
162
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="sequenceflow-unlabeled" sourceElement="_BPMNShape_StartEvent_3" targetElement="_BPMNShape_ExclusiveGateway_2">
163
- <di:waypoint xsi:type="dc:Point" x="204" y="114" />
164
- <di:waypoint xsi:type="dc:Point" x="312" y="114" />
110
+ </bpmndi:BPMNEdge>
111
+ <bpmndi:BPMNEdge id="SequenceFlow_14kuv1e_di" bpmnElement="SequenceFlow_14kuv1e">
112
+ <di:waypoint xsi:type="dc:Point" x="486" y="347" />
113
+ <di:waypoint xsi:type="dc:Point" x="486" y="394" />
165
114
  <bpmndi:BPMNLabel>
166
- <dc:Bounds x="243" y="114" width="6" height="6" />
115
+ <dc:Bounds x="501" y="360.5" width="0" height="0" />
167
116
  </bpmndi:BPMNLabel>
168
117
  </bpmndi:BPMNEdge>
169
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="sequence-flow-no" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_CallActivity_2">
170
- <di:waypoint xsi:type="dc:Point" x="337" y="139" />
171
- <di:waypoint xsi:type="dc:Point" x="337" y="242" />
172
- <di:waypoint xsi:type="dc:Point" x="422" y="242" />
118
+ <bpmndi:BPMNShape id="Task_1fo1fvh_di" bpmnElement="Task_1fo1fvh">
119
+ <dc:Bounds x="436" y="500" width="100" height="80" />
120
+ </bpmndi:BPMNShape>
121
+ <bpmndi:BPMNEdge id="SequenceFlow_13rjp44_di" bpmnElement="SequenceFlow_13rjp44">
122
+ <di:waypoint xsi:type="dc:Point" x="486" y="474" />
123
+ <di:waypoint xsi:type="dc:Point" x="486" y="500" />
173
124
  <bpmndi:BPMNLabel>
174
- <dc:Bounds x="342" y="204" width="20" height="22" />
125
+ <dc:Bounds x="501" y="477" width="0" height="0" />
175
126
  </bpmndi:BPMNLabel>
176
127
  </bpmndi:BPMNEdge>
177
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="sequence-flow-yes" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_IntermediateThrowEvent_2">
178
- <di:waypoint xsi:type="dc:Point" x="362" y="114" />
179
- <di:waypoint xsi:type="dc:Point" x="397" y="114" />
128
+ <bpmndi:BPMNShape id="ExclusiveGateway_1dulwbf_di" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
129
+ <dc:Bounds x="578" y="515" width="50" height="50" />
180
130
  <bpmndi:BPMNLabel>
181
- <dc:Bounds x="335.49989765458423" y="114" width="90" height="22" />
131
+ <dc:Bounds x="590" y="565" width="25" height="12" />
182
132
  </bpmndi:BPMNLabel>
183
- </bpmndi:BPMNEdge>
184
- <bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="message-flow" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_Participant_3">
185
- <di:waypoint xsi:type="dc:Point" x="532" y="448" />
186
- <di:waypoint xsi:type="dc:Point" x="632" y="448" />
187
- <di:waypoint xsi:type="dc:Point" x="632" y="386" />
188
- <di:waypoint xsi:type="dc:Point" x="672" y="386" />
133
+ </bpmndi:BPMNShape>
134
+ <bpmndi:BPMNEdge id="SequenceFlow_1h7vuvi_di" bpmnElement="SequenceFlow_1h7vuvi">
135
+ <di:waypoint xsi:type="dc:Point" x="536" y="540" />
136
+ <di:waypoint xsi:type="dc:Point" x="578" y="540" />
189
137
  <bpmndi:BPMNLabel>
190
- <dc:Bounds x="612" y="456" width="91" height="38" />
138
+ <dc:Bounds x="557" y="515" width="0" height="0" />
191
139
  </bpmndi:BPMNLabel>
192
140
  </bpmndi:BPMNEdge>
193
- <bpmndi:BPMNShape id="_BPMNShape_DataStoreReference_2" bpmnElement="data-store-reference">
194
- <dc:Bounds x="156" y="547" width="50" height="50" />
141
+ <bpmndi:BPMNShape id="EndEvent_0c4s9zs_di" bpmnElement="EndEvent_1">
142
+ <dc:Bounds x="585" y="416" width="36" height="36" />
195
143
  <bpmndi:BPMNLabel>
196
- <dc:Bounds x="149" y="602" width="64" height="22" />
144
+ <dc:Bounds x="603" y="452" width="0" height="0" />
197
145
  </bpmndi:BPMNLabel>
198
146
  </bpmndi:BPMNShape>
199
- <bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_2" bpmnElement="data-object-reference">
200
- <dc:Bounds x="267" y="547" width="36" height="50" />
147
+ <bpmndi:BPMNEdge id="SequenceFlow_0kmqqm9_di" bpmnElement="SequenceFlow_0kmqqm9">
148
+ <di:waypoint xsi:type="dc:Point" x="536" y="434" />
149
+ <di:waypoint xsi:type="dc:Point" x="585" y="434" />
201
150
  <bpmndi:BPMNLabel>
202
- <dc:Bounds x="245" y="602" width="80" height="38" />
151
+ <dc:Bounds x="561" y="409" width="0" height="0" />
203
152
  </bpmndi:BPMNLabel>
204
- </bpmndi:BPMNShape>
205
- <bpmndi:BPMNShape id="_BPMNShape_DataInput_2" bpmnElement="data-input">
206
- <dc:Bounds x="372" y="547" width="36" height="50" />
153
+ </bpmndi:BPMNEdge>
154
+ <bpmndi:BPMNShape id="DataObjectReference_024w45b_di" bpmnElement="DataObjectReference_1">
155
+ <dc:Bounds x="223" y="515" width="36" height="50" />
207
156
  <bpmndi:BPMNLabel>
208
- <dc:Bounds x="390" y="602" width="0" height="0" />
157
+ <dc:Bounds x="241" y="565" width="0" height="0" />
209
158
  </bpmndi:BPMNLabel>
210
159
  </bpmndi:BPMNShape>
211
- <bpmndi:BPMNShape id="_BPMNShape_DataOutput_2" bpmnElement="data-output">
212
- <dc:Bounds x="504" y="547" width="36" height="50" />
160
+ <bpmndi:BPMNShape id="DataStoreReference_0b4jv9b_di" bpmnElement="DataStoreReference_1">
161
+ <dc:Bounds x="315.54926829268294" y="515" width="50" height="50" />
213
162
  <bpmndi:BPMNLabel>
214
- <dc:Bounds x="522" y="602" width="0" height="0" />
163
+ <dc:Bounds x="341" y="565" width="0" height="0" />
215
164
  </bpmndi:BPMNLabel>
216
165
  </bpmndi:BPMNShape>
217
- <bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_1" bpmnElement="DataInputAssociation_1" sourceElement="_BPMNShape_DataInput_2" targetElement="_BPMNShape_SubProcess_2">
218
- <di:waypoint xsi:type="dc:Point" x="403" y="547" />
219
- <di:waypoint xsi:type="dc:Point" x="420" y="514" />
220
- </bpmndi:BPMNEdge>
221
- <bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_1" bpmnElement="DataOutputAssociation_1" sourceElement="_BPMNShape_SubProcess_2" targetElement="_BPMNShape_DataOutput_2">
222
- <di:waypoint xsi:type="dc:Point" x="495" y="514" />
223
- <di:waypoint xsi:type="dc:Point" x="510" y="547" />
224
- </bpmndi:BPMNEdge>
225
- <bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_2" bpmnElement="DataInputAssociation_2" sourceElement="_BPMNShape_DataStoreReference_2" targetElement="_BPMNShape_SubProcess_3">
226
- <di:waypoint xsi:type="dc:Point" x="185" y="547" />
227
- <di:waypoint xsi:type="dc:Point" x="200" y="444" />
228
- </bpmndi:BPMNEdge>
229
- <bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_2" bpmnElement="message-flow-unlabeled" sourceElement="_BPMNShape_Participant_3" targetElement="_BPMNShape_Participant_2">
230
- <di:waypoint xsi:type="dc:Point" x="672" y="386" />
231
- <di:waypoint xsi:type="dc:Point" x="600" y="386" />
166
+ <bpmndi:BPMNEdge id="MessageFlow_0pmpiw7_di" bpmnElement="MessageFlow_1">
167
+ <di:waypoint xsi:type="dc:Point" x="486" y="580" />
168
+ <di:waypoint xsi:type="dc:Point" x="486" y="646" />
232
169
  <bpmndi:BPMNLabel>
233
- <dc:Bounds x="591" y="368" width="90" height="6" />
170
+ <dc:Bounds x="488" y="603" width="25" height="13" />
234
171
  </bpmndi:BPMNLabel>
235
172
  </bpmndi:BPMNEdge>
236
- <bpmndi:BPMNShape id="Task_0da8ze1_di" bpmnElement="empty-task">
237
- <dc:Bounds x="472" y="74" width="100" height="80" />
173
+ <bpmndi:BPMNShape id="Participant_0kzj58d_di" bpmnElement="Participant_2">
174
+ <dc:Bounds x="161" y="646" width="600" height="250" />
238
175
  </bpmndi:BPMNShape>
239
- <bpmndi:BPMNEdge id="SequenceFlow_1r751z0_di" bpmnElement="SequenceFlow_1r751z0">
240
- <di:waypoint xsi:type="dc:Point" x="433" y="114" />
241
- <di:waypoint xsi:type="dc:Point" x="472" y="114" />
242
- <bpmndi:BPMNLabel>
243
- <dc:Bounds x="407.5" y="89" width="90" height="20" />
244
- </bpmndi:BPMNLabel>
245
- </bpmndi:BPMNEdge>
246
176
  </bpmndi:BPMNPlane>
247
177
  </bpmndi:BPMNDiagram>
248
- </bpmn2:definitions>
178
+ </bpmn:definitions>
@@ -154,7 +154,7 @@ describe('custom elements', function() {
154
154
  );
155
155
 
156
156
 
157
- it('should connect a bpmn element to a custom one',
157
+ it('should not connect a bpmn element to a custom one',
158
158
  inject(function(elementFactory, dragging, elementRegistry, connect) {
159
159
 
160
160
  // given
@@ -170,11 +170,8 @@ describe('custom elements', function() {
170
170
 
171
171
  dragging.end();
172
172
 
173
- var connection = triangle.incoming[0];
174
-
175
173
  // then
176
- expect(connection.type).to.equal('bpmn:Association');
177
- expect(connection.source).to.equal(subProcess);
174
+ expect(triangle.incoming).to.have.lengthOf(0);
178
175
  })
179
176
  );
180
177
 
@@ -58,6 +58,43 @@ describe('features/copy-paste', function() {
58
58
  });
59
59
 
60
60
 
61
+ it('should paste twice', inject(
62
+ function(elementRegistry, canvas, copyPaste) {
63
+ // given
64
+ var element = elementRegistry.get('SubProcess_1kd6ist'),
65
+ rootElement = canvas.getRootElement();
66
+
67
+ // when
68
+ copyPaste.copy(element);
69
+
70
+ copyPaste.paste({
71
+ element: rootElement,
72
+ point: {
73
+ x: 1000,
74
+ y: 100
75
+ }
76
+ });
77
+
78
+ copyPaste.paste({
79
+ element: rootElement,
80
+ point: {
81
+ x: 1500,
82
+ y: 275
83
+ }
84
+ });
85
+
86
+ // then
87
+ expect(rootElement.children).to.have.length(3);
88
+
89
+ var pastedElements = elementRegistry.filter(function(e) {
90
+ return e !== element && is(e, 'bpmn:SubProcess');
91
+ });
92
+
93
+ expect(pastedElements[0].id).to.not.equal(pastedElements[1].id);
94
+ }
95
+ ));
96
+
97
+
61
98
  describe('integration', function() {
62
99
 
63
100
  it('should retain label\'s relative position',
@@ -489,6 +526,7 @@ describe('features/copy-paste', function() {
489
526
  it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
490
527
 
491
528
  it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
529
+
492
530
  });
493
531
 
494
532
  });
@@ -0,0 +1,133 @@
1
+ 'use strict';
2
+
3
+ /* global bootstrapViewer, inject */
4
+
5
+
6
+ var labelEditingModule = require('../../../../lib/features/label-editing'),
7
+ coreModule = require('../../../../lib/core'),
8
+ draggingModule = require('diagram-js/lib/features/dragging'),
9
+ modelingModule = require('diagram-js/lib/features/modeling');
10
+
11
+ describe('features - label-editing preview', function() {
12
+
13
+ var diagramXML = require('../../../fixtures/bpmn/features/label-editing/labels.bpmn');
14
+
15
+ var testModules = [ labelEditingModule, coreModule, draggingModule, modelingModule ];
16
+
17
+ beforeEach(bootstrapViewer(diagramXML, { modules: testModules }));
18
+
19
+ describe('activate', function() {
20
+
21
+ it('[external labels AND text annotations ] should add marker to hide element on activate', inject(function(directEditing, elementRegistry) {
22
+
23
+ // given
24
+ var textAnnotation = elementRegistry.get('TextAnnotation_1');
25
+
26
+ // when
27
+ directEditing.activate(textAnnotation);
28
+
29
+ // then
30
+ var gfx = elementRegistry.getGraphics(textAnnotation);
31
+
32
+ expect(gfx.classList.contains('djs-element-hidden')).to.be.true;
33
+ }));
34
+
35
+
36
+ it('[internal labels] should add marker to hide label on activate', inject(function(directEditing, elementRegistry) {
37
+
38
+ // given
39
+ var task = elementRegistry.get('Task_1');
40
+
41
+ // when
42
+ directEditing.activate(task);
43
+
44
+ // then
45
+ var gfx = elementRegistry.getGraphics(task);
46
+
47
+ expect(gfx.classList.contains('djs-label-hidden')).to.be.true;
48
+ }));
49
+
50
+ });
51
+
52
+
53
+ describe('resize', function() {
54
+
55
+ it('[text annotations] should resize preview on resize', inject(function(directEditing, elementRegistry, eventBus, labelEditingPreview) {
56
+
57
+ // given
58
+ var textAnnotation = elementRegistry.get('TextAnnotation_1');
59
+ directEditing.activate(textAnnotation);
60
+
61
+ // when
62
+ eventBus.fire('directEditing.resize', {
63
+ width: 200,
64
+ height: 200,
65
+ dx: 100,
66
+ dy: 100
67
+ });
68
+
69
+ // then
70
+ var bounds = labelEditingPreview.path.getBBox();
71
+
72
+ expect(bounds).to.eql({ x: 0, y: 0, width: 10, height: 300 });
73
+ }));
74
+
75
+
76
+ it('[text annotations] should resize preview below 0', inject(function(directEditing, elementRegistry, eventBus, labelEditingPreview) {
77
+
78
+ // given
79
+ var textAnnotation = elementRegistry.get('TextAnnotation_1');
80
+ directEditing.activate(textAnnotation);
81
+
82
+ // when
83
+ eventBus.fire('directEditing.resize', {
84
+ width: 200,
85
+ height: 200,
86
+ dx: -300,
87
+ dy: -300
88
+ });
89
+
90
+ // then
91
+ var bounds = labelEditingPreview.path.getBBox();
92
+
93
+ expect(bounds).to.eql({ x: 0, y: 0, width: 10, height: 0 });
94
+ }));
95
+
96
+ });
97
+
98
+
99
+ describe('complete/cancel', function() {
100
+
101
+ it('[external labels AND text annotations] should remove marker to hide element on complete', inject(function(directEditing, elementRegistry) {
102
+
103
+ // given
104
+ var textAnnotation = elementRegistry.get('TextAnnotation_1');
105
+ directEditing.activate(textAnnotation);
106
+
107
+ // when
108
+ directEditing.complete();
109
+
110
+ // then
111
+ var gfx = elementRegistry.getGraphics(textAnnotation);
112
+
113
+ expect(gfx.classList.contains('djs-element-hidden')).to.be.false;
114
+ }));
115
+
116
+
117
+ it('[internal labels] should remove marker to hide label on complete', inject(function(directEditing, elementRegistry) {
118
+
119
+ // given
120
+ var task = elementRegistry.get('Task_1');
121
+ directEditing.activate(task);
122
+
123
+ // when
124
+ directEditing.complete();
125
+
126
+ // then
127
+ var gfx = elementRegistry.getGraphics(task);
128
+
129
+ expect(gfx.classList.contains('djs-label-hidden')).to.be.false;
130
+ }));
131
+
132
+ });
133
+ });