bpmn-js 0.13.1 → 0.14.1

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 (65) hide show
  1. package/.travis.yml +1 -1
  2. package/.wiredeps +5 -5
  3. package/lib/Modeler.js +52 -9
  4. package/lib/Viewer.js +205 -105
  5. package/lib/draw/BpmnRenderer.js +4 -0
  6. package/lib/features/context-pad/ContextPadProvider.js +21 -15
  7. package/lib/features/label-editing/LabelEditingProvider.js +21 -6
  8. package/lib/features/label-editing/LabelUtil.js +6 -6
  9. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +19 -17
  10. package/lib/features/modeling/BpmnUpdater.js +12 -4
  11. package/lib/features/modeling/ElementFactory.js +25 -11
  12. package/lib/features/modeling/{BpmnLabelSupport.js → behavior/LabelBehavior.js} +14 -4
  13. package/lib/features/modeling/behavior/ModelingFeedback.js +3 -3
  14. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +4 -4
  15. package/lib/features/modeling/behavior/index.js +2 -0
  16. package/lib/features/modeling/cmd/SplitLaneHandler.js +6 -4
  17. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +6 -0
  18. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +6 -0
  19. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +6 -4
  20. package/lib/features/modeling/index.js +1 -2
  21. package/lib/features/ordering/BpmnOrderingProvider.js +7 -4
  22. package/lib/features/ordering/index.js +3 -0
  23. package/lib/features/palette/PaletteProvider.js +13 -9
  24. package/lib/features/palette/index.js +2 -1
  25. package/lib/features/popup-menu/ReplaceMenuProvider.js +22 -10
  26. package/lib/features/popup-menu/index.js +4 -0
  27. package/lib/features/replace/BpmnReplace.js +17 -1
  28. package/lib/features/replace/ReplaceOptions.js +22 -0
  29. package/lib/features/replace/index.js +0 -1
  30. package/lib/features/rules/BpmnRules.js +14 -0
  31. package/lib/features/snapping/BpmnSnapping.js +2 -2
  32. package/lib/import/BpmnImporter.js +30 -18
  33. package/lib/import/BpmnTreeWalker.js +42 -15
  34. package/lib/import/Importer.js +19 -7
  35. package/lib/import/index.js +3 -0
  36. package/package.json +8 -7
  37. package/test/fixtures/bpmn/extension/custom-override.bpmn +54 -0
  38. package/test/fixtures/bpmn/extension/custom.bpmn +54 -0
  39. package/test/fixtures/bpmn/features/modeling/update-label.bpmn +24 -0
  40. package/test/fixtures/json/model/custom-override.json +39 -0
  41. package/test/fixtures/json/model/custom.json +39 -0
  42. package/test/helper/index.js +6 -1
  43. package/test/integration/ReimportSpec.js +89 -0
  44. package/test/spec/ModelerSpec.js +155 -9
  45. package/test/spec/ViewerSpec.js +328 -43
  46. package/test/spec/features/context-pad/ContextPadProviderSpec.js +5 -5
  47. package/test/spec/features/label-editing/LabelEditingProviderSpec.js +201 -128
  48. package/test/spec/features/modeling/AppendShapeSpec.js +0 -43
  49. package/test/spec/features/modeling/UpdateLabelSpec.js +129 -0
  50. package/test/spec/features/modeling/append/TextAnnotationSpec.js +13 -0
  51. package/test/spec/features/modeling/behavior/LabelBehaviorSpec.js +144 -0
  52. package/test/spec/features/modeling/layout/LayoutAssociationSpec.js +3 -3
  53. package/test/spec/features/ordering/BpmnOrderingProviderSpec.js +41 -2
  54. package/test/spec/features/ordering/ordering-subprocesses.bpmn +14 -2
  55. package/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +0 -4
  56. package/test/spec/features/replace/BpmnReplace.collaboration.bpmn +70 -0
  57. package/test/spec/features/replace/BpmnReplaceSpec.js +37 -0
  58. package/test/spec/features/rules/BpmnRules.collaboration.bpmn +6 -1
  59. package/test/spec/features/rules/BpmnRulesSpec.js +32 -0
  60. package/test/spec/features/snapping/BpmnSnappingSpec.js +16 -6
  61. package/test/spec/i18n/custom-translate/custom-translate.js +15 -0
  62. package/test/spec/i18n/custom-translate/index.js +3 -0
  63. package/test/spec/i18n/translateSpec.js +53 -0
  64. package/test/spec/import/ImporterSpec.js +3 -3
  65. package/test/spec/features/modeling/BpmnLabelSupportSpec.js +0 -37
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ var TestHelper = require('../../../../TestHelper');
4
+
5
+ /* global bootstrapModeler, inject */
6
+
7
+ var assign = require('lodash/object/assign');
8
+
9
+ var modelingModule = require('../../../../../lib/features/modeling'),
10
+ coreModule = require('../../../../../lib/core');
11
+
12
+ var LabelUtil = require('../../../../../lib/util/LabelUtil');
13
+
14
+
15
+ describe('behavior - LabelBehavior', function() {
16
+
17
+ var diagramXML = require('../../../../fixtures/bpmn/basic.bpmn');
18
+
19
+ var testModules = [ modelingModule, coreModule ];
20
+
21
+ beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
22
+
23
+
24
+ describe('add label', function() {
25
+
26
+ it('should add to sequence flow', inject(function(elementRegistry, modeling) {
27
+
28
+ // given
29
+ var startEvent = elementRegistry.get('StartEvent_1'),
30
+ task = elementRegistry.get('Task_1');
31
+
32
+ // when
33
+ var connection = modeling.connect(startEvent, task);
34
+
35
+ // then
36
+ expect(connection.label).to.exist;
37
+ }));
38
+
39
+
40
+ it('should add to exclusive gateway', inject(function(elementFactory, elementRegistry, modeling) {
41
+
42
+ // given
43
+ var parentShape = elementRegistry.get('Process_1'),
44
+ newShapeAttrs = { type: 'bpmn:ExclusiveGateway' };
45
+
46
+ // when
47
+ var newShape = modeling.createShape(newShapeAttrs, { x: 50, y: 50 }, parentShape);
48
+
49
+ // then
50
+ expect(newShape.label).to.exist;
51
+ }));
52
+
53
+
54
+ it('should not add to task', inject(function(elementFactory, elementRegistry, modeling) {
55
+
56
+ // given
57
+ var parentShape = elementRegistry.get('Process_1'),
58
+ newShapeAttrs = { type: 'bpmn:Task' };
59
+
60
+ // when
61
+ var newShape = modeling.createShape(newShapeAttrs, { x: 50, y: 50 }, parentShape);
62
+
63
+ // then
64
+ expect(newShape.label).not.to.exist;
65
+ }));
66
+
67
+
68
+ describe('on append', function() {
69
+
70
+ it('correctly wired and positioned', inject(function(elementRegistry, modeling, commandStack) {
71
+
72
+ // given
73
+ var startEventShape = elementRegistry.get('StartEvent_1');
74
+
75
+ // when
76
+ var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:EndEvent' });
77
+
78
+ var label = targetShape.label;
79
+
80
+ // then
81
+ expect(label).to.exist;
82
+ expect(elementRegistry.get(label.id)).to.exist;
83
+
84
+ expect(label).to.have.bounds(assign({ x: 262, y: 138 }, LabelUtil.DEFAULT_LABEL_SIZE));
85
+ }));
86
+
87
+
88
+ it('with di', inject(function(elementRegistry, modeling, commandStack) {
89
+
90
+ // given
91
+ var startEventShape = elementRegistry.get('StartEvent_1');
92
+
93
+ // when
94
+ var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:EndEvent' }),
95
+ target = targetShape.businessObject;
96
+
97
+ // then
98
+ expect(target.di.label).to.exist;
99
+
100
+ expect(target.di.label).to.have.bounds(targetShape.label);
101
+ }));
102
+
103
+ });
104
+
105
+
106
+ it('should add with di', inject(function(elementFactory, elementRegistry, modeling) {
107
+
108
+ // given
109
+ var startEventShape = elementRegistry.get('StartEvent_1');
110
+
111
+ // when
112
+ var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:EndEvent' }),
113
+ target = targetShape.businessObject;
114
+
115
+ // then
116
+ expect(target.di.label).to.exist;
117
+
118
+ expect(target.di.label).to.have.bounds(targetShape.label);
119
+ }));
120
+
121
+ });
122
+
123
+
124
+ describe('move label', function() {
125
+
126
+ it('should move start event label', inject(function(elementRegistry, modeling) {
127
+
128
+ // given
129
+ var startEventShape = elementRegistry.get('StartEvent_1'),
130
+ startEvent = startEventShape.businessObject,
131
+ labelShape = startEventShape.label;
132
+
133
+ // when
134
+ modeling.moveElements([ labelShape ], { x: 10, y: -10 });
135
+
136
+ // then
137
+ expect(labelShape).to.have.position({ x: 156, y: 128 });
138
+ expect(startEvent.di.label).to.have.position({ x: 156, y: 128 });
139
+ }));
140
+
141
+ });
142
+
143
+
144
+ });
@@ -35,7 +35,7 @@ describe('features/modeling - layout association', function() {
35
35
 
36
36
  // then
37
37
  expect(waypoints).to.eql([
38
- { original: { x: 400, y: 400 }, x: 370, y: 360 },
38
+ { original: { x: 400, y: 400 }, x: 389, y: 385 },
39
39
  { original: { x: 191, y: 120 }, x: 202, y: 134 }
40
40
  ]);
41
41
 
@@ -57,7 +57,7 @@ describe('features/modeling - layout association', function() {
57
57
 
58
58
  // then
59
59
  expect(waypoints).to.eql([
60
- { original: { x: 420, y: 400 }, x: 387, y: 360 },
60
+ { original: { x: 420, y: 400 }, x: 408, y: 385 },
61
61
  { original: { x: 191, y: 120 }, x: 202, y: 134 }
62
62
  ]);
63
63
 
@@ -85,7 +85,7 @@ describe('features/modeling - layout association', function() {
85
85
 
86
86
  // then
87
87
  expect(waypoints).to.eql([
88
- { original: { x: 420, y: 400 }, x: 412, y: 360 },
88
+ { original: { x: 420, y: 400 }, x: 417, y: 385 },
89
89
  { x: 400, y: 300 },
90
90
  { original: { x: 191, y: 120 }, x: 204, y: 131 }
91
91
  ]);
@@ -98,10 +98,10 @@ describe('features/modeling - ordering', function() {
98
98
  it('should stay behind boundary events', inject(function() {
99
99
 
100
100
  // when
101
- move('BoundaryEvent_1', { x: 50, y: 0 }, 'SubProcess_1', true);
101
+ move('BoundaryEvent_SubProcess', { x: 50, y: 0 }, 'SubProcess_1', true);
102
102
 
103
103
  // then
104
- expectZOrder('SubProcess_1', 'BoundaryEvent_1');
104
+ expectZOrder('SubProcess_1', 'BoundaryEvent_SubProcess');
105
105
  }));
106
106
 
107
107
 
@@ -126,4 +126,43 @@ describe('features/modeling - ordering', function() {
126
126
 
127
127
  });
128
128
 
129
+
130
+ describe('transaction', function() {
131
+
132
+ var diagramXML = require('./ordering-subprocesses.bpmn');
133
+
134
+ beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
135
+
136
+
137
+ it('should stay behind boundary events', inject(function() {
138
+
139
+ // when
140
+ move('BoundaryEvent_Transaction', { x: 50, y: 0 }, 'Transaction_1', true);
141
+
142
+ // then
143
+ expectZOrder('Transaction_1', 'BoundaryEvent_Transaction');
144
+ }));
145
+
146
+
147
+ it('should stay behind tasks', inject(function() {
148
+
149
+ // when
150
+ move(['Task_1', 'Task_2'], { x: 50, y: 0 }, 'Transaction_1');
151
+
152
+ // then
153
+ expectZOrder('Transaction_1', 'Task_1', 'Task_2');
154
+ }));
155
+
156
+
157
+ it('should be in front of tasks if task is not a child', inject(function() {
158
+
159
+ // when
160
+ move(['Task_1', 'Task_2'], { x: 200, y: 0 }, 'Root');
161
+
162
+ // then
163
+ expectZOrder('Task_1', 'Task_2', 'Transaction_1');
164
+ }));
165
+
166
+ });
167
+
129
168
  });
@@ -1,3 +1,4 @@
1
+
1
2
  <?xml version="1.0" encoding="UTF-8"?>
2
3
  <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" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
3
4
  <bpmn:process id="Process_1" isExecutable="false">
@@ -5,14 +6,16 @@
5
6
  <bpmn:task id="Task_1" />
6
7
  <bpmn:task id="Task_2" />
7
8
  </bpmn:subProcess>
8
- <bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="SubProcess_1" />
9
+ <bpmn:boundaryEvent id="BoundaryEvent_SubProcess" attachedToRef="SubProcess_1" />
10
+ <bpmn:transaction id="Transaction_1" />
11
+ <bpmn:boundaryEvent id="BoundaryEvent_Transaction" attachedToRef="Transaction_1" />
9
12
  </bpmn:process>
10
13
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
11
14
  <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
12
15
  <bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
13
16
  <dc:Bounds x="100" y="44" width="350" height="200" />
14
17
  </bpmndi:BPMNShape>
15
- <bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
18
+ <bpmndi:BPMNShape id="BoundaryEvent_SubProcess_di" bpmnElement="BoundaryEvent_SubProcess">
16
19
  <dc:Bounds x="157" y="226" width="36" height="36" />
17
20
  <bpmndi:BPMNLabel>
18
21
  <dc:Bounds x="130" y="262" width="90" height="20" />
@@ -24,6 +27,15 @@
24
27
  <bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
25
28
  <dc:Bounds x="305" y="68" width="100" height="80" />
26
29
  </bpmndi:BPMNShape>
30
+ <bpmndi:BPMNShape id="Transaction_1_di" bpmnElement="Transaction_1" isExpanded="true">
31
+ <dc:Bounds x="100" y="302" width="350" height="200" />
32
+ </bpmndi:BPMNShape>
33
+ <bpmndi:BPMNShape id="BoundaryEvent_Transaction_di" bpmnElement="BoundaryEvent_Transaction">
34
+ <dc:Bounds x="249" y="484" width="36" height="36" />
35
+ <bpmndi:BPMNLabel>
36
+ <dc:Bounds x="222" y="520" width="90" height="20" />
37
+ </bpmndi:BPMNLabel>
38
+ </bpmndi:BPMNShape>
27
39
  </bpmndi:BPMNPlane>
28
40
  </bpmndi:BPMNDiagram>
29
41
  </bpmn:definitions>
@@ -7,9 +7,7 @@ var TestHelper = require('../../../TestHelper');
7
7
  var globalEvent = require('../../../util/MockEvents.js').createEvent;
8
8
 
9
9
  var coreModule = require('../../../../lib/core'),
10
- popupMenuModule = require('diagram-js/lib/features/popup-menu'),
11
10
  modelingModule = require('../../../../lib/features/modeling'),
12
- replaceModule = require('../../../../lib/features/replace'),
13
11
  replaceMenuProviderModule = require('../../../../lib/features/popup-menu'),
14
12
  customRulesModule = require('../../../util/custom-rules');
15
13
 
@@ -60,8 +58,6 @@ describe('features/popup-menu - replace menu provider', function() {
60
58
  var testModules = [
61
59
  coreModule,
62
60
  modelingModule,
63
- popupMenuModule,
64
- replaceModule,
65
61
  replaceMenuProviderModule,
66
62
  customRulesModule
67
63
  ];
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <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">
3
+ <bpmn:collaboration id="Collaboration_1wsnry3">
4
+ <bpmn:participant id="Participant_1" name="Pool" processRef="Process_1" />
5
+ <bpmn:participant id="Participant_2" name="Pool" />
6
+ <bpmn:messageFlow id="MessageFlow_2" sourceRef="Participant_2" targetRef="Participant_1" />
7
+ <bpmn:messageFlow id="MessageFlow_1" sourceRef="Task_1" targetRef="Participant_2" />
8
+ <bpmn:messageFlow id="MessageFlow_3" sourceRef="EndEvent_1" targetRef="Participant_2" />
9
+ </bpmn:collaboration>
10
+ <bpmn:process id="Process_1" isExecutable="false">
11
+ <bpmn:laneSet>
12
+ <bpmn:lane id="Lane_1">
13
+ <bpmn:flowNodeRef>Task_1</bpmn:flowNodeRef>
14
+ <bpmn:flowNodeRef>EndEvent_1</bpmn:flowNodeRef>
15
+ </bpmn:lane>
16
+ <bpmn:lane id="Lane_2" />
17
+ </bpmn:laneSet>
18
+ <bpmn:task id="Task_1" />
19
+ <bpmn:endEvent id="EndEvent_1">
20
+ <bpmn:messageEventDefinition />
21
+ </bpmn:endEvent>
22
+ </bpmn:process>
23
+ <bpmn:process id="Process_18059hr" isExecutable="false" />
24
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
25
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1wsnry3">
26
+ <bpmndi:BPMNShape id="Participant_0dhyklk_di" bpmnElement="Participant_1">
27
+ <dc:Bounds x="181" y="82" width="458" height="271" />
28
+ </bpmndi:BPMNShape>
29
+ <bpmndi:BPMNShape id="Lane_1lr6kkb_di" bpmnElement="Lane_1">
30
+ <dc:Bounds x="211" y="82" width="428" height="138" />
31
+ </bpmndi:BPMNShape>
32
+ <bpmndi:BPMNShape id="Lane_0c9o07a_di" bpmnElement="Lane_2">
33
+ <dc:Bounds x="211" y="220" width="428" height="133" />
34
+ </bpmndi:BPMNShape>
35
+ <bpmndi:BPMNShape id="Participant_06fwm9a_di" bpmnElement="Participant_2">
36
+ <dc:Bounds x="237" y="436" width="378" height="115" />
37
+ </bpmndi:BPMNShape>
38
+ <bpmndi:BPMNEdge id="MessageFlow_1xdh89f_di" bpmnElement="MessageFlow_2">
39
+ <di:waypoint xsi:type="dc:Point" x="368" y="436" />
40
+ <di:waypoint xsi:type="dc:Point" x="368" y="353" />
41
+ <bpmndi:BPMNLabel>
42
+ <dc:Bounds x="381" y="384.5" width="90" height="20" />
43
+ </bpmndi:BPMNLabel>
44
+ </bpmndi:BPMNEdge>
45
+ <bpmndi:BPMNShape id="Task_0atv48s_di" bpmnElement="Task_1">
46
+ <dc:Bounds x="276" y="112" width="100" height="80" />
47
+ </bpmndi:BPMNShape>
48
+ <bpmndi:BPMNEdge id="MessageFlow_19wrxbj_di" bpmnElement="MessageFlow_1">
49
+ <di:waypoint xsi:type="dc:Point" x="326" y="192" />
50
+ <di:waypoint xsi:type="dc:Point" x="326" y="436" />
51
+ <bpmndi:BPMNLabel>
52
+ <dc:Bounds x="281" y="304" width="90" height="20" />
53
+ </bpmndi:BPMNLabel>
54
+ </bpmndi:BPMNEdge>
55
+ <bpmndi:BPMNShape id="EndEvent_1ooqi8q_di" bpmnElement="EndEvent_1">
56
+ <dc:Bounds x="535" y="134" width="36" height="36" />
57
+ <bpmndi:BPMNLabel>
58
+ <dc:Bounds x="508" y="170" width="90" height="20" />
59
+ </bpmndi:BPMNLabel>
60
+ </bpmndi:BPMNShape>
61
+ <bpmndi:BPMNEdge id="MessageFlow_15s8xey_di" bpmnElement="MessageFlow_3">
62
+ <di:waypoint xsi:type="dc:Point" x="553" y="170" />
63
+ <di:waypoint xsi:type="dc:Point" x="553" y="434" />
64
+ <bpmndi:BPMNLabel>
65
+ <dc:Bounds x="508" y="293" width="90" height="20" />
66
+ </bpmndi:BPMNLabel>
67
+ </bpmndi:BPMNEdge>
68
+ </bpmndi:BPMNPlane>
69
+ </bpmndi:BPMNDiagram>
70
+ </bpmn:definitions>
@@ -187,6 +187,43 @@ describe('features/replace - bpmn replace', function() {
187
187
  });
188
188
 
189
189
 
190
+ describe('should replace in collaboration', function() {
191
+
192
+ var diagramXML = require('./BpmnReplace.collaboration.bpmn');
193
+
194
+ beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
195
+
196
+
197
+ it('expanded with collapsed pool', inject(function(elementRegistry, bpmnReplace) {
198
+
199
+ // given
200
+ var shape = elementRegistry.get('Participant_1');
201
+
202
+ // when
203
+ var newShape = bpmnReplace.replaceElement(shape, { type: 'bpmn:Participant', isExpanded: false });
204
+
205
+ // then
206
+ expect(isExpanded(newShape)).to.be.false; // collapsed
207
+ expect(newShape.children).to.be.empty;
208
+ }));
209
+
210
+
211
+ it('collapsed with expande pool', inject(function(elementRegistry, bpmnReplace) {
212
+
213
+ // given
214
+ var shape = elementRegistry.get('Participant_2');
215
+
216
+ // when
217
+ var newShape = bpmnReplace.replaceElement(shape, { type: 'bpmn:Participant', isExpanded: true });
218
+
219
+ // then
220
+ expect(isExpanded(newShape)).to.be.true; // expanded
221
+ expect(newShape.children).to.be.empty;
222
+ }));
223
+
224
+ });
225
+
226
+
190
227
  describe('position and size', function() {
191
228
 
192
229
  var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
@@ -1,9 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <bpmn2:definitions xmlns:bpmn2="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="_biH3sOTeEeS2YerRfpjPrw" targetNamespace="http://activiti.org/bpmn" exporter="camunda modeler" exporterVersion="2.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
3
3
  <bpmn2:collaboration id="Collaboration">
4
- <bpmn2:textAnnotation id="TextAnnotation_Global" />
5
4
  <bpmn2:participant id="Participant" name="Pool" processRef="Process" />
6
5
  <bpmn2:participant id="OtherParticipant" name="Pool" processRef="OtherProcess" />
6
+ <bpmn2:participant id="CollapsedParticipant" name="Pool" />
7
+ <bpmn2:textAnnotation id="TextAnnotation_Global" />
7
8
  </bpmn2:collaboration>
8
9
  <bpmn2:process id="Process" isExecutable="false">
9
10
  <bpmn2:startEvent id="StartEvent_None" />
@@ -39,6 +40,7 @@
39
40
  <bpmn2:task id="Task_in_OtherParticipant" />
40
41
  <bpmn2:textAnnotation id="TextAnnotation_OtherParticipant" />
41
42
  </bpmn2:process>
43
+ <bpmn2:process id="Process_18q5tmq" isExecutable="false" />
42
44
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
43
45
  <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration">
44
46
  <bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant" isHorizontal="true">
@@ -128,6 +130,9 @@
128
130
  <dc:Bounds x="299" y="114" width="90" height="20" />
129
131
  </bpmndi:BPMNLabel>
130
132
  </bpmndi:BPMNShape>
133
+ <bpmndi:BPMNShape id="Participant_09perow_di" bpmnElement="CollapsedParticipant">
134
+ <dc:Bounds x="125" y="704" width="594" height="117" />
135
+ </bpmndi:BPMNShape>
131
136
  </bpmndi:BPMNPlane>
132
137
  </bpmndi:BPMNDiagram>
133
138
  </bpmn2:definitions>
@@ -839,6 +839,13 @@ describe('features/modeling/rules - BpmnRules', function() {
839
839
  expectCanDrop('TextAnnotation_Global', 'Participant', true);
840
840
  }));
841
841
 
842
+ it('drop element -> collapsed Participant', inject(function(canvas){
843
+ expectCanDrop('StartEvent_None', 'CollapsedParticipant', false);
844
+ expectCanDrop('SubProcess', 'CollapsedParticipant', false);
845
+ expectCanDrop('Task_in_SubProcess', 'CollapsedParticipant', false);
846
+ expectCanDrop('TextAnnotation_Global', 'CollapsedParticipant', false);
847
+ }));
848
+
842
849
  });
843
850
 
844
851
 
@@ -1310,4 +1317,29 @@ describe('features/modeling/rules - BpmnRules', function() {
1310
1317
 
1311
1318
  });
1312
1319
 
1320
+
1321
+ describe('labels', function() {
1322
+
1323
+ var testXML = require('./BpmnRules.process.bpmn');
1324
+
1325
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1326
+
1327
+
1328
+ it('should filter labels', inject(function(elementRegistry, rules) {
1329
+
1330
+ // given
1331
+ var startEventShape = elementRegistry.get('StartEvent_None'),
1332
+ startEventLabel = startEventShape.label;
1333
+
1334
+ // when
1335
+ var allowed = rules.allowed('elements.delete', {
1336
+ elements: [ startEventShape, startEventLabel ]
1337
+ });
1338
+
1339
+ // then
1340
+ expect(allowed).to.eql([ startEventShape ]);
1341
+ }));
1342
+
1343
+ });
1344
+
1313
1345
  });
@@ -374,10 +374,15 @@ describe('features/snapping - BpmnSnapping', function() {
374
374
 
375
375
  describe('on SubProcess resize', function() {
376
376
 
377
-
378
377
  var diagramXML = require('./BpmnSnapping.subProcess-resize.bpmn');
379
378
 
380
- var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ];
379
+ var testResizeModules = [
380
+ coreModule,
381
+ modelingModule,
382
+ resizeModule,
383
+ rulesModule,
384
+ snappingModule
385
+ ];
381
386
 
382
387
  beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules }));
383
388
 
@@ -399,15 +404,20 @@ describe('features/snapping - BpmnSnapping', function() {
399
404
 
400
405
  describe('on TextAnnotation resize', function() {
401
406
 
402
-
403
407
  var diagramXML = require('./BpmnSnapping.textAnnotation-resize.bpmn');
404
408
 
405
- var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ];
409
+ var testResizeModules = [
410
+ coreModule,
411
+ modelingModule,
412
+ resizeModule,
413
+ rulesModule,
414
+ snappingModule
415
+ ];
406
416
 
407
417
  beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules }));
408
418
 
409
419
 
410
- it('should snap a TextAnnotation to minimum bounds', inject(function(elementRegistry, resize, dragging) {
420
+ it('should snap to minimum bounds', inject(function(elementRegistry, resize, dragging) {
411
421
 
412
422
  var textAnnotation = elementRegistry.get('TextAnnotation');
413
423
 
@@ -416,7 +426,7 @@ describe('features/snapping - BpmnSnapping', function() {
416
426
  dragging.end();
417
427
 
418
428
  expect(textAnnotation.width).to.equal(50);
419
- expect(textAnnotation.height).to.equal(50);
429
+ expect(textAnnotation.height).to.equal(30);
420
430
  }));
421
431
 
422
432
  });
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var translate = require('diagram-js/lib/i18n/translate/translate');
4
+
5
+ module.exports = function customTranslate(template, replacements) {
6
+ if (template === 'Remove') {
7
+ template = 'Eliminar';
8
+ }
9
+
10
+ if (template === 'Activate the hand tool') {
11
+ template = 'Activar herramienta mano';
12
+ }
13
+
14
+ return translate(template, replacements);
15
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ translate: [ 'value', require('./custom-translate') ]
3
+ };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ require('test/TestHelper');
4
+
5
+ /* global bootstrapModeler, inject */
6
+
7
+ var coreModule = require('lib/core'),
8
+ translateModule = require('diagram-js/lib/i18n/translate'),
9
+ customTranslateModule = require('./custom-translate'),
10
+ modelingModule = require('lib/features/modeling'),
11
+ paletteModule = require('lib/features/palette'),
12
+ contextPadModule = require('lib/features/context-pad');
13
+
14
+ var diagramXML = require('test/fixtures/bpmn/simple.bpmn');
15
+
16
+
17
+ describe('i18n - translate', function() {
18
+
19
+ beforeEach(bootstrapModeler(diagramXML, {
20
+ modules: [
21
+ coreModule,
22
+ modelingModule,
23
+ paletteModule,
24
+ contextPadModule,
25
+ translateModule,
26
+ customTranslateModule
27
+ ]
28
+ }));
29
+
30
+
31
+ it('should translate palette', inject(function(palette) {
32
+
33
+ // when
34
+ var handToolEntry = palette.getEntries()['hand-tool'];
35
+
36
+ // then
37
+ expect(handToolEntry.title).to.equal('Activar herramienta mano');
38
+ }));
39
+
40
+
41
+ it('should translate context pad', inject(function(contextPad) {
42
+
43
+ // given
44
+ contextPad.open('Task_1');
45
+
46
+ // when
47
+ var deleteEntry = contextPad._current.entries.delete;
48
+
49
+ // then
50
+ expect(deleteEntry.title).to.equal('Eliminar');
51
+ }));
52
+
53
+ });
@@ -45,7 +45,7 @@ describe('import - Importer', function() {
45
45
 
46
46
  describe('events', function() {
47
47
 
48
- it('should fire <import.start> and <import.success>', function(done) {
48
+ it('should fire <import.render.start> and <import.render.complete>', function(done) {
49
49
 
50
50
  // given
51
51
  var xml = require('../../fixtures/bpmn/import/process.bpmn');
@@ -55,13 +55,13 @@ describe('import - Importer', function() {
55
55
  var eventBus = diagram.get('eventBus');
56
56
 
57
57
  // log events
58
- eventBus.on('import.start', function(event) {
58
+ eventBus.on('import.render.start', function(event) {
59
59
  expect(event.definitions).to.exist;
60
60
 
61
61
  eventCount++;
62
62
  });
63
63
 
64
- eventBus.on('import.success', function(event) {
64
+ eventBus.on('import.render.complete', function(event) {
65
65
  expect(event).to.have.property('error');
66
66
  expect(event).to.have.property('warnings');
67
67
 
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- var TestHelper = require('../../../TestHelper');
4
-
5
- /* global bootstrapModeler, inject */
6
-
7
- var modelingModule = require('../../../../lib/features/modeling'),
8
- coreModule = require('../../../../lib/core');
9
-
10
- describe('features - bpmn-label-support', function() {
11
-
12
- var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
13
-
14
- var testModules = [ modelingModule, coreModule ];
15
-
16
- beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
17
-
18
- describe('should not add a label on create', function() {
19
-
20
- it('should not add a label on create', inject(function(elementFactory, elementRegistry, modeling, canvas) {
21
- // when
22
- var startEvent = elementRegistry.get('StartEvent_1'),
23
- task = elementRegistry.get('Task_1');
24
-
25
- modeling.connect(startEvent, task);
26
-
27
- var labels = elementRegistry.filter(function(element) {
28
- return element.type === 'label';
29
- });
30
-
31
- // then
32
- expect(labels).to.have.length(2);
33
- }));
34
-
35
- });
36
-
37
- });