@@ -7,6 +7,10 @@ import {
7
7
find
8
8
} from 'min-dash' ;
9
9
10
+ import {
11
+ getDi
12
+ } from 'lib/util/ModelUtil' ;
13
+
10
14
import modelingModule from 'lib/features/modeling' ;
11
15
import coreModule from 'lib/core' ;
12
16
@@ -41,17 +45,17 @@ describe('features/modeling - append shape', function() {
41
45
// given
42
46
var startEventShape = elementRegistry . get ( 'StartEvent_1' ) ;
43
47
44
- var startEvent = startEventShape . businessObject ;
48
+ var startEventDi = getDi ( startEventShape ) ;
45
49
46
50
// when
47
51
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:Task' } ) ,
48
- target = targetShape . businessObject ;
52
+ targetDi = getDi ( targetShape ) ;
49
53
50
54
// then
51
- expect ( target . di ) . to . exist ;
52
- expect ( target . di . $parent ) . to . eql ( startEvent . di . $parent ) ;
55
+ expect ( targetDi ) . to . exist ;
56
+ expect ( targetDi . $parent ) . to . eql ( startEventDi . $parent ) ;
53
57
54
- expect ( target . di ) . to . have . bounds ( targetShape ) ;
58
+ expect ( targetDi ) . to . have . bounds ( targetShape ) ;
55
59
} ) ) ;
56
60
57
61
@@ -105,17 +109,19 @@ describe('features/modeling - append shape', function() {
105
109
var startEventShape = elementRegistry . get ( 'StartEvent_1' ) ,
106
110
subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
107
111
108
- var subProcess = subProcessShape . businessObject ;
112
+ var subProcess = subProcessShape . businessObject ,
113
+ subProcessDi = getDi ( subProcessShape ) ;
109
114
110
115
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:Task' } ) ,
111
- target = targetShape . businessObject ;
116
+ target = targetShape . businessObject ,
117
+ targetDi = getDi ( targetShape ) ;
112
118
113
119
// when
114
120
commandStack . undo ( ) ;
115
121
116
122
// then
117
123
expect ( subProcess . get ( 'flowElements' ) ) . not . to . include ( target ) ;
118
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( target . di ) ;
124
+ expect ( subProcessDi . $parent . get ( 'planeElement' ) ) . not . to . include ( targetDi ) ;
119
125
} ) ) ;
120
126
121
127
@@ -126,14 +132,17 @@ describe('features/modeling - append shape', function() {
126
132
subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
127
133
128
134
var startEvent = startEventShape . businessObject ,
135
+ startEventDi = getDi ( startEventShape ) ,
129
136
subProcess = subProcessShape . businessObject ;
130
137
131
138
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:EndEvent' } ) ,
132
139
target = targetShape . businessObject ;
133
140
134
141
var connection = find ( subProcess . get ( 'flowElements' ) , function ( e ) {
135
- return e . sourceRef === startEvent && e . targetRef === target ;
136
- } ) ;
142
+ return e . sourceRef === startEvent && e . targetRef === target ;
143
+ } ) ,
144
+ connectionDi = getDi ( connection ) ;
145
+
137
146
138
147
// when
139
148
commandStack . undo ( ) ;
@@ -142,7 +151,7 @@ describe('features/modeling - append shape', function() {
142
151
expect ( connection . sourceRef ) . to . be . null ;
143
152
expect ( connection . targetRef ) . to . be . null ;
144
153
expect ( connection . $parent ) . to . be . null ;
145
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( connection . di ) ;
154
+ expect ( startEventDi . $parent . get ( 'planeElement' ) ) . not . to . include ( connectionDi ) ;
146
155
147
156
expect ( targetShape . label ) . not . to . exist ;
148
157
expect ( elementRegistry . get ( target . id + '_label' ) ) . not . to . exist ;
@@ -156,14 +165,16 @@ describe('features/modeling - append shape', function() {
156
165
var subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
157
166
158
167
var startEvent = startEventShape . businessObject ,
159
- subProcess = subProcessShape . businessObject ;
168
+ subProcess = subProcessShape . businessObject ,
169
+ subProcessDi = getDi ( subProcessShape ) ;
160
170
161
171
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:Task' } ) ,
162
172
target = targetShape . businessObject ;
163
173
164
174
var connection = find ( subProcess . get ( 'flowElements' ) , function ( e ) {
165
- return e . sourceRef === startEvent && e . targetRef === target ;
166
- } ) ;
175
+ return e . sourceRef === startEvent && e . targetRef === target ;
176
+ } ) ,
177
+ connectionDi = getDi ( connection ) ;
167
178
168
179
// when
169
180
commandStack . undo ( ) ;
@@ -176,7 +187,7 @@ describe('features/modeling - append shape', function() {
176
187
expect ( target . get ( 'incoming' ) ) . not . to . include ( connection ) ;
177
188
178
189
expect ( connection . $parent ) . to . be . null ;
179
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( connection . di ) ;
190
+ expect ( subProcessDi . $parent . get ( 'planeElement' ) ) . not . to . include ( connectionDi ) ;
180
191
181
192
expect ( elementRegistry . get ( targetShape . id ) ) . not . to . exist ;
182
193
} ) ) ;
@@ -189,14 +200,16 @@ describe('features/modeling - append shape', function() {
189
200
var subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
190
201
191
202
var startEvent = startEventShape . businessObject ,
192
- subProcess = subProcessShape . businessObject ;
203
+ subProcess = subProcessShape . businessObject ,
204
+ subProcessDi = getDi ( subProcessShape ) ;
193
205
194
206
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:Task' } ) ,
195
207
target = targetShape . businessObject ;
196
208
197
209
var connection = find ( subProcess . get ( 'flowElements' ) , function ( e ) {
198
- return e . sourceRef === startEvent && e . targetRef === target ;
199
- } ) ;
210
+ return e . sourceRef === startEvent && e . targetRef === target ;
211
+ } ) ,
212
+ connectionDi = getDi ( connection ) ;
200
213
201
214
// when
202
215
commandStack . undo ( ) ;
@@ -205,7 +218,7 @@ describe('features/modeling - append shape', function() {
205
218
expect ( connection . sourceRef ) . to . be . null ;
206
219
expect ( connection . targetRef ) . to . be . null ;
207
220
expect ( connection . $parent ) . to . be . null ;
208
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( connection . di ) ;
221
+ expect ( subProcessDi . $parent . get ( 'planeElement' ) ) . not . to . include ( connectionDi ) ;
209
222
210
223
expect ( elementRegistry . get ( connection . id + '_label' ) ) . not . to . exist ;
211
224
} ) ) ;
@@ -248,14 +261,16 @@ describe('features/modeling - append shape', function() {
248
261
var subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
249
262
250
263
var startEvent = startEventShape . businessObject ,
251
- subProcess = subProcessShape . businessObject ;
264
+ subProcess = subProcessShape . businessObject ,
265
+ subProcessDi = getDi ( subProcessShape ) ;
252
266
253
267
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:Task' } ) ,
254
268
target = targetShape . businessObject ;
255
269
256
270
var connection = find ( subProcess . get ( 'flowElements' ) , function ( e ) {
257
- return e . sourceRef === startEvent && e . targetRef === target ;
258
- } ) ;
271
+ return e . sourceRef === startEvent && e . targetRef === target ;
272
+ } ) ,
273
+ connectionDi = getDi ( connection ) ;
259
274
260
275
// when
261
276
commandStack . undo ( ) ;
@@ -267,7 +282,7 @@ describe('features/modeling - append shape', function() {
267
282
expect ( connection . targetRef ) . to . be . null ;
268
283
expect ( connection . $parent ) . to . be . null ;
269
284
270
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( connection . di ) ;
285
+ expect ( subProcessDi . $parent . get ( 'planeElement' ) ) . not . to . include ( connectionDi ) ;
271
286
} ) ) ;
272
287
273
288
} ) ;
@@ -315,17 +330,19 @@ describe('features/modeling - append shape', function() {
315
330
var startEventShape = elementRegistry . get ( 'StartEvent_1' ) ;
316
331
var subProcessShape = elementRegistry . get ( 'SubProcess_1' ) ;
317
332
318
- var subProcess = subProcessShape . businessObject ;
333
+ var subProcess = subProcessShape . businessObject ,
334
+ subProcessDi = getDi ( subProcessShape ) ;
319
335
320
336
var targetShape = modeling . appendShape ( startEventShape , { type : 'bpmn:ExclusiveGateway' } ) ,
321
- target = targetShape . businessObject ;
337
+ target = targetShape . businessObject ,
338
+ targetDi = getDi ( targetShape ) ;
322
339
323
340
// when
324
341
commandStack . undo ( ) ;
325
342
326
343
// then
327
344
expect ( subProcess . get ( 'flowElements' ) ) . not . to . include ( target ) ;
328
- expect ( subProcess . di . $parent . get ( 'planeElement' ) ) . not . to . include ( target . di ) ;
345
+ expect ( subProcessDi . $parent . get ( 'planeElement' ) ) . not . to . include ( targetDi ) ;
329
346
} ) ) ;
330
347
331
348
} ) ;
0 commit comments