bpmn-js 0.20.6 → 0.22.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 (410) hide show
  1. package/.eslintrc +33 -33
  2. package/.npmignore +8 -8
  3. package/.travis.yml +19 -17
  4. package/.wiredeps +88 -88
  5. package/CONTRIBUTING.md +55 -55
  6. package/Gruntfile.js +129 -129
  7. package/LICENSE +22 -22
  8. package/README.md +113 -113
  9. package/assets/bpmn-font/css/bpmn-embedded.css +159 -159
  10. package/assets/bpmn-font/css/bpmn.css +161 -161
  11. package/assets/bpmn-font/font/bpmn.svg +116 -116
  12. package/docs/architecture/overview.svg +48 -48
  13. package/docs/project/COMMIT_MESSAGES.md +82 -82
  14. package/docs/project/SETUP.md +66 -66
  15. package/docs/project/setup-alternative.sh +41 -41
  16. package/docs/project/setup.bat +45 -45
  17. package/docs/project/setup.sh +40 -40
  18. package/docs/translations.json +97 -97
  19. package/lib/Modeler.js +208 -208
  20. package/lib/NavigatedViewer.js +27 -27
  21. package/lib/Viewer.js +503 -503
  22. package/lib/core/index.js +5 -5
  23. package/lib/draw/BpmnRenderer.js +1934 -1934
  24. package/lib/draw/PathMap.js +478 -478
  25. package/lib/draw/index.js +5 -5
  26. package/lib/features/auto-resize/BpmnAutoResize.js +34 -34
  27. package/lib/features/auto-resize/BpmnAutoResizeProvider.js +51 -51
  28. package/lib/features/auto-resize/index.js +5 -5
  29. package/lib/features/context-pad/ContextPadProvider.js +374 -374
  30. package/lib/features/context-pad/index.js +11 -11
  31. package/lib/features/copy-paste/BpmnCopyPaste.js +157 -154
  32. package/lib/features/copy-paste/index.js +7 -7
  33. package/lib/features/distribute-elements/BpmnDistributeElements.js +34 -34
  34. package/lib/features/distribute-elements/index.js +7 -7
  35. package/lib/features/editor-actions/BpmnEditorActions.js +130 -130
  36. package/lib/features/editor-actions/index.js +15 -15
  37. package/lib/features/global-connect/BpmnGlobalConnect.js +49 -49
  38. package/lib/features/global-connect/index.js +7 -7
  39. package/lib/features/keyboard/BpmnKeyBindings.js +72 -72
  40. package/lib/features/keyboard/index.js +7 -7
  41. package/lib/features/label-editing/LabelEditingPreview.js +122 -0
  42. package/lib/features/label-editing/LabelEditingProvider.js +292 -193
  43. package/lib/features/label-editing/LabelUtil.js +43 -43
  44. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +116 -112
  45. package/lib/features/label-editing/index.js +14 -9
  46. package/lib/features/modeling/BpmnFactory.js +97 -97
  47. package/lib/features/modeling/BpmnLayouter.js +191 -191
  48. package/lib/features/modeling/BpmnUpdater.js +692 -688
  49. package/lib/features/modeling/ElementFactory.js +218 -218
  50. package/lib/features/modeling/Modeling.js +183 -183
  51. package/lib/features/modeling/behavior/AppendBehavior.js +42 -42
  52. package/lib/features/modeling/behavior/CopyPasteBehavior.js +69 -69
  53. package/lib/features/modeling/behavior/CreateBoundaryEventBehavior.js +51 -51
  54. package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +37 -37
  55. package/lib/features/modeling/behavior/CreateParticipantBehavior.js +91 -91
  56. package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +151 -151
  57. package/lib/features/modeling/behavior/DeleteLaneBehavior.js +107 -107
  58. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +165 -131
  59. package/lib/features/modeling/behavior/ImportDockingFix.js +80 -80
  60. package/lib/features/modeling/behavior/LabelBehavior.js +222 -222
  61. package/lib/features/modeling/behavior/ModelingFeedback.js +50 -50
  62. package/lib/features/modeling/behavior/RemoveElementBehavior.js +73 -73
  63. package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +50 -50
  64. package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +128 -128
  65. package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +118 -116
  66. package/lib/features/modeling/behavior/ResizeLaneBehavior.js +59 -59
  67. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +138 -138
  68. package/lib/features/modeling/behavior/UnclaimIdBehavior.js +27 -27
  69. package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +54 -54
  70. package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +156 -156
  71. package/lib/features/modeling/behavior/index.js +44 -44
  72. package/lib/features/modeling/behavior/util/GeometricUtil.js +129 -129
  73. package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +218 -218
  74. package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +233 -233
  75. package/lib/features/modeling/behavior/util/LineIntersect.js +36 -36
  76. package/lib/features/modeling/cmd/AddLaneHandler.js +83 -83
  77. package/lib/features/modeling/cmd/IdClaimHandler.js +41 -41
  78. package/lib/features/modeling/cmd/ResizeLaneHandler.js +125 -125
  79. package/lib/features/modeling/cmd/SplitLaneHandler.js +82 -82
  80. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +78 -78
  81. package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +185 -185
  82. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +264 -264
  83. package/lib/features/modeling/index.js +23 -23
  84. package/lib/features/modeling/util/LaneUtil.js +157 -157
  85. package/lib/features/modeling/util/ModelingUtil.js +48 -48
  86. package/lib/features/ordering/BpmnOrderingProvider.js +147 -147
  87. package/lib/features/ordering/index.js +6 -6
  88. package/lib/features/palette/PaletteProvider.js +158 -158
  89. package/lib/features/palette/index.js +13 -13
  90. package/lib/features/popup-menu/ReplaceMenuProvider.js +479 -479
  91. package/lib/features/popup-menu/index.js +7 -7
  92. package/lib/features/popup-menu/util/TypeUtil.js +41 -41
  93. package/lib/features/replace/BpmnReplace.js +197 -197
  94. package/lib/features/replace/ReplaceOptions.js +787 -787
  95. package/lib/features/replace/index.js +7 -7
  96. package/lib/features/replace-preview/BpmnReplacePreview.js +113 -113
  97. package/lib/features/replace-preview/index.js +5 -5
  98. package/lib/features/rules/BpmnRules.js +807 -806
  99. package/lib/features/rules/index.js +7 -7
  100. package/lib/features/search/BpmnSearchProvider.js +128 -128
  101. package/lib/features/search/index.js +7 -7
  102. package/lib/features/snapping/BpmnSnapping.js +511 -495
  103. package/lib/features/snapping/BpmnSnappingUtil.js +159 -159
  104. package/lib/features/snapping/index.js +3 -3
  105. package/lib/import/BpmnImporter.js +302 -302
  106. package/lib/import/BpmnTreeWalker.js +445 -445
  107. package/lib/import/Importer.js +69 -69
  108. package/lib/import/Util.js +8 -8
  109. package/lib/import/index.js +5 -5
  110. package/lib/util/DiUtil.js +60 -60
  111. package/lib/util/LabelUtil.js +139 -139
  112. package/lib/util/ModelUtil.js +31 -31
  113. package/lib/util/PoweredByUtil.js +82 -82
  114. package/lib/util/model/ModelCloneHelper.js +201 -201
  115. package/lib/util/model/ModelCloneUtils.js +35 -35
  116. package/package.json +22 -22
  117. package/resources/initial.bpmn +12 -12
  118. package/resources/screencast.gif +0 -0
  119. package/tasks/banner.txt +11 -11
  120. package/tasks/bundle.js +162 -162
  121. package/test/TestHelper.js +17 -17
  122. package/test/config/karma.unit.js +46 -46
  123. package/test/config/translation-reporter.js +48 -48
  124. package/test/fixtures/bpmn/align-elements.bpmn +136 -136
  125. package/test/fixtures/bpmn/basic.bpmn +17 -17
  126. package/test/fixtures/bpmn/boundary-events.bpmn +59 -59
  127. package/test/fixtures/bpmn/collaboration/collaboration-empty-participant.bpmn +13 -13
  128. package/test/fixtures/bpmn/collaboration/collaboration-message-flows.bpmn +89 -89
  129. package/test/fixtures/bpmn/collaboration/collaboration-participant.bpmn +59 -59
  130. package/test/fixtures/bpmn/collaboration/process-empty.bpmn +6 -6
  131. package/test/fixtures/bpmn/collaboration/process.bpmn +47 -47
  132. package/test/fixtures/bpmn/collaboration-data-items.bpmn +81 -81
  133. package/test/fixtures/bpmn/collaboration-message-flows.bpmn +82 -82
  134. package/test/fixtures/bpmn/collaboration-sequence-flows.bpmn +83 -83
  135. package/test/fixtures/bpmn/collaboration.bpmn +50 -50
  136. package/test/fixtures/bpmn/complex.bpmn +2151 -2151
  137. package/test/fixtures/bpmn/conditions.bpmn +82 -82
  138. package/test/fixtures/bpmn/containers.bpmn +128 -128
  139. package/test/fixtures/bpmn/distribute-elements-filtering.bpmn +58 -58
  140. package/test/fixtures/bpmn/distribute-elements.bpmn +232 -232
  141. package/test/fixtures/bpmn/draw/activity-markers-combination.bpmn +141 -141
  142. package/test/fixtures/bpmn/draw/activity-markers-simple.bpmn +47 -47
  143. package/test/fixtures/bpmn/draw/activity-markers.bpmn +212 -212
  144. package/test/fixtures/bpmn/draw/associations.bpmn +55 -55
  145. package/test/fixtures/bpmn/draw/boundary-event-with-refnode.bpmn +81 -81
  146. package/test/fixtures/bpmn/draw/boundary-event-without-refnode.bpmn +81 -81
  147. package/test/fixtures/bpmn/draw/boundary-event-z-index.bpmn +82 -82
  148. package/test/fixtures/bpmn/draw/call-activity.bpmn +12 -12
  149. package/test/fixtures/bpmn/draw/colors.bpmn +411 -411
  150. package/test/fixtures/bpmn/draw/conditional-flow-default.bpmn +100 -100
  151. package/test/fixtures/bpmn/draw/conditional-flow-gateways.bpmn +72 -72
  152. package/test/fixtures/bpmn/draw/conditional-flow-typed-task.bpmn +33 -33
  153. package/test/fixtures/bpmn/draw/conditional-flow.bpmn +248 -248
  154. package/test/fixtures/bpmn/draw/data-objects.bpmn +265 -265
  155. package/test/fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn +200 -200
  156. package/test/fixtures/bpmn/draw/event-subprocesses-expanded.bpmn +274 -274
  157. package/test/fixtures/bpmn/draw/events-interrupting.bpmn +370 -370
  158. package/test/fixtures/bpmn/draw/events.bpmn +374 -374
  159. package/test/fixtures/bpmn/draw/gateway-type-default.bpmn +45 -45
  160. package/test/fixtures/bpmn/draw/gateways.bpmn +61 -61
  161. package/test/fixtures/bpmn/draw/group.bpmn +24 -24
  162. package/test/fixtures/bpmn/draw/message-marker.bpmn +112 -112
  163. package/test/fixtures/bpmn/draw/pools-with-collection-marker.bpmn +104 -104
  164. package/test/fixtures/bpmn/draw/pools.bpmn +82 -82
  165. package/test/fixtures/bpmn/draw/task-types.bpmn +77 -77
  166. package/test/fixtures/bpmn/draw/text-annotation.bpmn +71 -71
  167. package/test/fixtures/bpmn/draw/xor.bpmn +45 -45
  168. package/test/fixtures/bpmn/empty-definitions.bpmn +4 -4
  169. package/test/fixtures/bpmn/error/categoryValue.bpmn +26 -26
  170. package/test/fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn +9 -9
  171. package/test/fixtures/bpmn/error/duplicate-ids.bpmn +14 -14
  172. package/test/fixtures/bpmn/error/invalid-child.bpmn +6 -6
  173. package/test/fixtures/bpmn/error/missing-namespace.bpmn +12 -12
  174. package/test/fixtures/bpmn/event-sub-processes.bpmn +47 -47
  175. package/test/fixtures/bpmn/extension/camunda.bpmn +52 -52
  176. package/test/fixtures/bpmn/extension/custom-override.bpmn +53 -53
  177. package/test/fixtures/bpmn/extension/custom.bpmn +53 -53
  178. package/test/fixtures/bpmn/features/copy-paste/basic.bpmn +111 -111
  179. package/test/fixtures/bpmn/features/copy-paste/collaboration-multiple.bpmn +102 -102
  180. package/test/fixtures/bpmn/features/copy-paste/collaboration.bpmn +74 -74
  181. package/test/fixtures/bpmn/features/copy-paste/data-associations.bpmn +61 -61
  182. package/test/fixtures/bpmn/features/copy-paste/properties.bpmn +43 -43
  183. package/test/fixtures/bpmn/features/drop/drop.bpmn +41 -41
  184. package/test/fixtures/bpmn/features/drop/recursive-task.bpmn +37 -37
  185. package/test/fixtures/bpmn/features/label-editing/labels.bpmn +178 -248
  186. package/test/fixtures/bpmn/features/modeling/update-label.bpmn +24 -24
  187. package/test/fixtures/bpmn/features/replace/01_replace.bpmn +193 -193
  188. package/test/fixtures/bpmn/features/replace/association-gateways.bpmn +173 -173
  189. package/test/fixtures/bpmn/features/replace/cancel-events.bpmn +49 -49
  190. package/test/fixtures/bpmn/features/replace/clone-properties.bpmn +141 -141
  191. package/test/fixtures/bpmn/features/replace/connection.bpmn +42 -42
  192. package/test/fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn +72 -72
  193. package/test/fixtures/bpmn/features/rules/link-event.bpmn +35 -35
  194. package/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn +30 -30
  195. package/test/fixtures/bpmn/flow-markers.bpmn +212 -212
  196. package/test/fixtures/bpmn/import/boundaryEvent.bpmn +33 -33
  197. package/test/fixtures/bpmn/import/collaboration.bpmn +50 -50
  198. package/test/fixtures/bpmn/import/collapsed/collaboration.bpmn +76 -76
  199. package/test/fixtures/bpmn/import/collapsed/process.bpmn +84 -84
  200. package/test/fixtures/bpmn/import/collapsed/processWithChildren.bpmn +273 -273
  201. package/test/fixtures/bpmn/import/default-attrs.bpmn +24 -24
  202. package/test/fixtures/bpmn/import/error/boundaryEvent-invalidAttachToRef.bpmn +30 -30
  203. package/test/fixtures/bpmn/import/error/boundaryEvent-missingAttachToRef.bpmn +33 -33
  204. package/test/fixtures/bpmn/import/error/dangling-process-message-flow.bpmn +81 -81
  205. package/test/fixtures/bpmn/import/error/invalid-flow-element.bpmn +35 -35
  206. package/test/fixtures/bpmn/import/error/multiple-dis.bpmn +23 -23
  207. package/test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn +41 -41
  208. package/test/fixtures/bpmn/import/labels/collaboration.bpmn +72 -72
  209. package/test/fixtures/bpmn/import/labels/embedded.bpmn +39 -39
  210. package/test/fixtures/bpmn/import/labels/external-no-di.bpmn +42 -42
  211. package/test/fixtures/bpmn/import/labels/external.bpmn +69 -69
  212. package/test/fixtures/bpmn/import/position/position-testcase.bpmn +57 -57
  213. package/test/fixtures/bpmn/import/process.bpmn +60 -60
  214. package/test/fixtures/bpmn/nested-subprocesses.bpmn +118 -118
  215. package/test/fixtures/bpmn/sequence-flows.bpmn +60 -60
  216. package/test/fixtures/bpmn/simple-cropping.bpmn +84 -84
  217. package/test/fixtures/bpmn/simple-resizable.bpmn +50 -50
  218. package/test/fixtures/bpmn/simple.bpmn +60 -60
  219. package/test/fixtures/json/model/camunda.json +1042 -1042
  220. package/test/fixtures/json/model/custom-override.json +39 -39
  221. package/test/fixtures/json/model/custom.json +39 -39
  222. package/test/helper/TranslationCollector.js +17 -17
  223. package/test/helper/index.js +249 -249
  224. package/test/integration/CustomElementsSpec.js +223 -223
  225. package/test/integration/ReimportSpec.js +89 -89
  226. package/test/integration/SimpleModelingSpec.js +29 -29
  227. package/test/integration/custom-elements/CustomElementFactory.js +77 -77
  228. package/test/integration/custom-elements/CustomRenderer.js +151 -151
  229. package/test/integration/custom-elements/CustomRules.js +148 -148
  230. package/test/integration/custom-elements/CustomUpdater.js +115 -115
  231. package/test/integration/custom-elements/index.js +7 -7
  232. package/test/integration/model/BpmnModdleSpec.js +65 -65
  233. package/test/matchers/JSONMatcher.js +19 -19
  234. package/test/spec/ModelerSpec.js +401 -401
  235. package/test/spec/NavigatedViewerSpec.js +58 -58
  236. package/test/spec/ViewerSpec.js +977 -977
  237. package/test/spec/draw/BpmnRendererSpec.js +311 -311
  238. package/test/spec/environment/MockingSpec.js +53 -53
  239. package/test/spec/features/align-elements/BpmnAlignElementsSpec.js +137 -137
  240. package/test/spec/features/auto-resize/AutoResize.lanes.bpmn +54 -54
  241. package/test/spec/features/auto-resize/AutoResize.multi-selection.bpmn +22 -22
  242. package/test/spec/features/auto-resize/AutoResize.nested-sub-processes.bpmn +47 -47
  243. package/test/spec/features/auto-resize/AutoResize.participant.bpmn +38 -38
  244. package/test/spec/features/auto-resize/AutoResize.space-tool.bpmn +38 -38
  245. package/test/spec/features/auto-resize/AutoResize.sub-processes.bpmn +37 -37
  246. package/test/spec/features/auto-resize/AutoResizeSpec.js +607 -607
  247. package/test/spec/features/context-pad/ContextPad.activation.bpmn +51 -51
  248. package/test/spec/features/context-pad/ContextPadProviderSpec.js +440 -440
  249. package/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +763 -725
  250. package/test/spec/features/copy-paste/DescriptorTree.js +58 -58
  251. package/test/spec/features/distribute-elements/BpmnDistributeElementsSpec.js +113 -113
  252. package/test/spec/features/editor-actions/BpmnEditorActionsSpec.js +72 -72
  253. package/test/spec/features/global-connect/BpmnGlobalConnectSpec.js +61 -61
  254. package/test/spec/features/keyboard/BpmnKeyBindingsSpec.js +142 -142
  255. package/test/spec/features/label-editing/LabelEditingPreviewSpec.js +133 -0
  256. package/test/spec/features/label-editing/LabelEditingProviderSpec.js +636 -601
  257. package/test/spec/features/label-editing/TouchIntegrationSpec.js +40 -40
  258. package/test/spec/features/modeling/AppendShapeSpec.js +332 -332
  259. package/test/spec/features/modeling/BendpointsSpec.js +25 -25
  260. package/test/spec/features/modeling/BpmnFactorySpec.js +73 -73
  261. package/test/spec/features/modeling/BpmnUpdater.bpmn +99 -99
  262. package/test/spec/features/modeling/BpmnUpdaterSpec.js +79 -79
  263. package/test/spec/features/modeling/CreateConnectionSpec.js +171 -171
  264. package/test/spec/features/modeling/DeleteConnectionSpec.js +75 -75
  265. package/test/spec/features/modeling/DeleteParticipantSpec.js +97 -97
  266. package/test/spec/features/modeling/DeleteShapeSpec.js +75 -75
  267. package/test/spec/features/modeling/DropSpec.js +123 -123
  268. package/test/spec/features/modeling/IdClaim.bpmn +13 -13
  269. package/test/spec/features/modeling/IdClaimSpec.js +50 -50
  270. package/test/spec/features/modeling/LabelBoundsSpec.js +342 -340
  271. package/test/spec/features/modeling/LabelBoundsSpec.simple.bpmn +27 -27
  272. package/test/spec/features/modeling/LabelLayouting.initial.bpmn +37 -37
  273. package/test/spec/features/modeling/LabelLayouting.move.bpmn +99 -99
  274. package/test/spec/features/modeling/LabelLayouting.special.bpmn +76 -76
  275. package/test/spec/features/modeling/LabelLayoutingSpec.js +603 -603
  276. package/test/spec/features/modeling/MoveConnectionSpec.js +101 -101
  277. package/test/spec/features/modeling/MoveElements.flow-collaboration.bpmn +45 -45
  278. package/test/spec/features/modeling/MoveElementsSpec.js +70 -70
  279. package/test/spec/features/modeling/MoveRulesSpec.js +151 -151
  280. package/test/spec/features/modeling/MoveShapeSpec.js +353 -353
  281. package/test/spec/features/modeling/ResizeShapeSpec.js +73 -73
  282. package/test/spec/features/modeling/SpaceToolSpec.js +251 -251
  283. package/test/spec/features/modeling/UpdateAttachmentSpec.js +96 -96
  284. package/test/spec/features/modeling/UpdateLabelSpec.js +130 -130
  285. package/test/spec/features/modeling/UpdatePropertiesSpec.js +503 -503
  286. package/test/spec/features/modeling/append/TextAnnotationSpec.js +136 -136
  287. package/test/spec/features/modeling/behavior/CompensationAssociationBehavior.bpmn +26 -26
  288. package/test/spec/features/modeling/behavior/CompensationAssociationBehaviorSpec.js +43 -43
  289. package/test/spec/features/modeling/behavior/CreateBoundaryEventBehaviorSpec.js +58 -58
  290. package/test/spec/features/modeling/behavior/CreateParticipantBehaviorSpec.js +224 -224
  291. package/test/spec/features/modeling/behavior/DataInputAssociationBehavior.bpmn +33 -33
  292. package/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js +146 -146
  293. package/test/spec/features/modeling/behavior/DataObjectBehavior.create-data-association.bpmn +21 -21
  294. package/test/spec/features/modeling/behavior/DataObjectBehavior.data-object-reference.bpmn +13 -13
  295. package/test/spec/features/modeling/behavior/DataObjectBehavior.remove-data-association.bpmn +41 -41
  296. package/test/spec/features/modeling/behavior/DataObjectBehaviorSpec.js +297 -297
  297. package/test/spec/features/modeling/behavior/DataStoreBehavior.bpmn +26 -26
  298. package/test/spec/features/modeling/behavior/DataStoreBehavior.connect.bpmn +57 -57
  299. package/test/spec/features/modeling/behavior/DataStoreBehaviorSpec.js +228 -228
  300. package/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn +71 -67
  301. package/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +591 -418
  302. package/test/spec/features/modeling/behavior/ImportDockingFix.bpmn +61 -61
  303. package/test/spec/features/modeling/behavior/ImportDockingFixSpec.js +37 -37
  304. package/test/spec/features/modeling/behavior/LabelBehaviorSpec.js +277 -277
  305. package/test/spec/features/modeling/behavior/ReconnectConnection.data-association.bpmn +41 -41
  306. package/test/spec/features/modeling/behavior/ReconnectConnectionSpec.js +120 -120
  307. package/test/spec/features/modeling/behavior/RemoveElementBehavior.bpmn +181 -181
  308. package/test/spec/features/modeling/behavior/RemoveElementBehavior.perpendicular.bpmn +159 -159
  309. package/test/spec/features/modeling/behavior/RemoveElementBehaviorSpec.js +251 -251
  310. package/test/spec/features/modeling/behavior/RemoveParticipantBehaviorSpec.js +125 -125
  311. package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.association.bpmn +26 -26
  312. package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.boundary-events.bpmn +40 -40
  313. package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.message-sequence-flow.bpmn +121 -121
  314. package/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js +439 -439
  315. package/test/spec/features/modeling/behavior/ReplaceElementBehaviourSpec.js +450 -450
  316. package/test/spec/features/modeling/behavior/ToggleElementCollapseBehaviourSpec.js +653 -653
  317. package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.bpmn +48 -48
  318. package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.js +77 -77
  319. package/test/spec/features/modeling/behavior/util/GeometricUtilSpec.js +127 -127
  320. package/test/spec/features/modeling/behavior/util/LabelLayoutUtilSpec.js +75 -75
  321. package/test/spec/features/modeling/behavior/util/LineAttachmentUtilSpec.js +294 -294
  322. package/test/spec/features/modeling/behavior/util/LineIntersectSpec.js +32 -32
  323. package/test/spec/features/modeling/lanes/AddLaneSpec.js +263 -263
  324. package/test/spec/features/modeling/lanes/DeleteLaneSpec.js +126 -126
  325. package/test/spec/features/modeling/lanes/ResizeLaneSpec.js +366 -366
  326. package/test/spec/features/modeling/lanes/SplitLaneSpec.js +216 -216
  327. package/test/spec/features/modeling/lanes/UpdateFlowNodeRefsSpec.js +271 -271
  328. package/test/spec/features/modeling/lanes/flowNodeRefs.bpmn +56 -56
  329. package/test/spec/features/modeling/lanes/lanes.bpmn +83 -83
  330. package/test/spec/features/modeling/lanes/participant-lane.bpmn +27 -27
  331. package/test/spec/features/modeling/lanes/participant-no-lane.bpmn +22 -22
  332. package/test/spec/features/modeling/layout/Helper.js +64 -64
  333. package/test/spec/features/modeling/layout/LayoutAssociationSpec.js +101 -101
  334. package/test/spec/features/modeling/layout/LayoutConnectionSpec.js +98 -98
  335. package/test/spec/features/modeling/layout/LayoutDataAssociationSpec.js +98 -98
  336. package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.bpmn +119 -119
  337. package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.js +313 -313
  338. package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.boundaryEvents.bpmn +65 -65
  339. package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.flowElements.bpmn +70 -70
  340. package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js +323 -323
  341. package/test/spec/features/ordering/BpmnOrderingProviderSpec.js +231 -231
  342. package/test/spec/features/ordering/Helper.js +185 -185
  343. package/test/spec/features/ordering/ordering-start-event.bpmn +17 -17
  344. package/test/spec/features/ordering/ordering-subprocesses.bpmn +41 -41
  345. package/test/spec/features/ordering/ordering.bpmn +105 -105
  346. package/test/spec/features/palette/PaletteProviderSpec.js +33 -33
  347. package/test/spec/features/popup-menu/ReplaceMenuProvider.collapsedSubProcess.bpmn +13 -13
  348. package/test/spec/features/popup-menu/ReplaceMenuProvider.compensation-activity.bpmn +12 -12
  349. package/test/spec/features/popup-menu/ReplaceMenuProvider.conditionalFlows.bpmn +66 -66
  350. package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlows.bpmn +126 -126
  351. package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn +48 -48
  352. package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn +48 -48
  353. package/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +1957 -1957
  354. package/test/spec/features/replace/BpmnReplace.collaboration.bpmn +70 -70
  355. package/test/spec/features/replace/BpmnReplace.compensation.bpmn +12 -12
  356. package/test/spec/features/replace/BpmnReplace.eventSubProcesses.bpmn +126 -126
  357. package/test/spec/features/replace/BpmnReplaceSpec.js +1302 -1302
  358. package/test/spec/features/replace/ReplaceRulesSpec.js +78 -78
  359. package/test/spec/features/replace/SubProcess-collapsed.bpmn +36 -36
  360. package/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js +304 -304
  361. package/test/spec/features/rules/BpmnRules.boundaryEvent.bpmn +93 -93
  362. package/test/spec/features/rules/BpmnRules.collaboration-dataAssociation.bpmn +35 -35
  363. package/test/spec/features/rules/BpmnRules.collaboration-lanes.bpmn +79 -79
  364. package/test/spec/features/rules/BpmnRules.collaboration.bpmn +138 -138
  365. package/test/spec/features/rules/BpmnRules.compensation.bpmn +65 -65
  366. package/test/spec/features/rules/BpmnRules.dataAssociation.bpmn +33 -33
  367. package/test/spec/features/rules/BpmnRules.eventBasedGateway.bpmn +82 -82
  368. package/test/spec/features/rules/BpmnRules.messageFlow.bpmn +27 -27
  369. package/test/spec/features/rules/BpmnRules.multiSelectionPools.bpmn +37 -37
  370. package/test/spec/features/rules/BpmnRules.process.bpmn +91 -91
  371. package/test/spec/features/rules/BpmnRules.subProcess-dataAssociation.bpmn +44 -44
  372. package/test/spec/features/rules/BpmnRulesSpec.js +1468 -1424
  373. package/test/spec/features/rules/Helper.js +82 -82
  374. package/test/spec/features/search/BpmnSearchProviderSpec.js +158 -158
  375. package/test/spec/features/search/bpmn-search-collaboration.bpmn +106 -106
  376. package/test/spec/features/search/bpmn-search.bpmn +100 -100
  377. package/test/spec/features/snapping/BpmnSnapping.connect.bpmn +36 -36
  378. package/test/spec/features/snapping/BpmnSnapping.labels.bpmn +27 -27
  379. package/test/spec/features/snapping/BpmnSnapping.lanes-resize.bpmn +43 -43
  380. package/test/spec/features/snapping/BpmnSnapping.participant-resize.bpmn +50 -50
  381. package/test/spec/features/snapping/BpmnSnapping.sequenceFlow.bpmn +41 -0
  382. package/test/spec/features/snapping/BpmnSnapping.subProcess-resize.bpmn +21 -21
  383. package/test/spec/features/snapping/BpmnSnapping.textAnnotation-resize.bpmn +22 -22
  384. package/test/spec/features/snapping/BpmnSnappingSpec.js +824 -758
  385. package/test/spec/features/snapping/BpmnSnappingUtil.lanes-flowNodes.bpmn +82 -82
  386. package/test/spec/features/snapping/BpmnSnappingUtil.lanes.bpmn +35 -35
  387. package/test/spec/features/snapping/BpmnSnappingUtilSpec.js +285 -285
  388. package/test/spec/i18n/custom-translate/custom-translate.js +14 -14
  389. package/test/spec/i18n/custom-translate/index.js +2 -2
  390. package/test/spec/i18n/translateSpec.js +56 -56
  391. package/test/spec/import/ImporterSpec.js +428 -428
  392. package/test/spec/import/ModelWiringSpec.js +194 -194
  393. package/test/spec/import/elements/AssociationSpec.collaboration.bpmn +51 -51
  394. package/test/spec/import/elements/AssociationSpec.compensation.bpmn +28 -28
  395. package/test/spec/import/elements/AssociationSpec.data-association.bpmn +39 -39
  396. package/test/spec/import/elements/AssociationSpec.data-input-output.bpmn +40 -40
  397. package/test/spec/import/elements/AssociationSpec.events.bpmn +51 -51
  398. package/test/spec/import/elements/AssociationSpec.js +175 -175
  399. package/test/spec/import/elements/AssociationSpec.text-annotation.bpmn +37 -37
  400. package/test/spec/import/elements/CollapsedSpec.js +118 -118
  401. package/test/spec/import/elements/LabelSpec.js +85 -85
  402. package/test/spec/import/lane-flowNodes.bpmn +44 -44
  403. package/test/spec/import/lane-missing-flowNodeRef.bpmn +24 -24
  404. package/test/spec/util/ModelCloneHelperSpec.js +381 -381
  405. package/test/spec/util/ModelUtilSpec.js +65 -65
  406. package/test/spec/util/camunda-moddle.js +70 -70
  407. package/test/util/MockEvents.js +62 -62
  408. package/test/util/ModelingUtil.js +117 -117
  409. package/test/util/custom-rules/CustomRules.js +18 -18
  410. package/test/util/custom-rules/index.js +4 -4
@@ -1,1424 +1,1468 @@
1
- 'use strict';
2
-
3
- var Helper = require('./Helper');
4
-
5
- var expectCanConnect = Helper.expectCanConnect,
6
- expectCanDrop = Helper.expectCanDrop,
7
- expectCanMove = Helper.expectCanMove;
8
-
9
- /* global bootstrapModeler, inject */
10
-
11
- var modelingModule = require('../../../../lib/features/modeling'),
12
- coreModule = require('../../../../lib/core');
13
-
14
-
15
- describe('features/modeling/rules - BpmnRules', function() {
16
-
17
- var testModules = [ coreModule, modelingModule ];
18
-
19
-
20
- describe('on process diagram', function() {
21
-
22
- var testXML = require('./BpmnRules.process.bpmn');
23
-
24
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
25
-
26
-
27
- it('connect StartEvent_None -> Task', inject(function() {
28
-
29
- expectCanConnect('StartEvent_None', 'Task', {
30
- sequenceFlow: true,
31
- messageFlow: false,
32
- association: false,
33
- dataAssociation: false
34
- });
35
- }));
36
-
37
-
38
- it('connect StartEvent_None -> TextAnnotation', inject(function() {
39
-
40
- expectCanConnect('StartEvent_None', 'TextAnnotation', {
41
- sequenceFlow: false,
42
- messageFlow: false,
43
- association: true,
44
- dataAssociation: false
45
- });
46
- }));
47
-
48
-
49
- it('connect Task -> IntermediateThrowEvent_Link', inject(function() {
50
-
51
- expectCanConnect('Task', 'IntermediateThrowEvent_Link', {
52
- sequenceFlow: true,
53
- messageFlow: false,
54
- association: false,
55
- dataAssociation: false
56
- });
57
- }));
58
-
59
-
60
- it('connect IntermediateThrowEvent_Link -> EndEvent_None', inject(function() {
61
-
62
- expectCanConnect('IntermediateThrowEvent_Link', 'EndEvent_None', {
63
- sequenceFlow: false,
64
- messageFlow: false,
65
- association: false,
66
- dataAssociation: false
67
- });
68
- }));
69
-
70
-
71
- it('connect StartEvent_None -> IntermediateCatchEvent_Link', inject(function() {
72
-
73
- expectCanConnect('StartEvent_None', 'IntermediateCatchEvent_Link', {
74
- sequenceFlow: false,
75
- messageFlow: false,
76
- association: false,
77
- dataAssociation: false
78
- });
79
- }));
80
-
81
-
82
- it('connect IntermediateCatchEvent_Link -> Task', inject(function() {
83
-
84
- expectCanConnect('IntermediateCatchEvent_Link', 'Task', {
85
- sequenceFlow: true,
86
- messageFlow: false,
87
- association: false,
88
- dataAssociation: false
89
- });
90
- }));
91
-
92
-
93
- it('drop TextAnnotation -> Process', inject(function() {
94
-
95
- expectCanDrop('TextAnnotation', 'Process', true);
96
- }));
97
-
98
-
99
- it('drop TextAnnotation -> SubProcess', inject(function() {
100
-
101
- expectCanDrop('TextAnnotation', 'SubProcess', true);
102
- }));
103
-
104
-
105
- it('drop Start Event -> Collapsed Sub Process', function() {
106
-
107
- expectCanDrop('StartEvent_None', 'CollapsedSubProcess', false);
108
- });
109
-
110
-
111
- it('connect DataObjectReference -> StartEvent_None', inject(function() {
112
-
113
- expectCanConnect('DataObjectReference', 'StartEvent_None', {
114
- sequenceFlow: false,
115
- messageFlow: false,
116
- association: false,
117
- dataAssociation: false
118
- });
119
- }));
120
-
121
-
122
- it('connect StartEvent_None -> DataObjectReference', inject(function() {
123
-
124
- expectCanConnect('StartEvent_None', 'DataObjectReference', {
125
- sequenceFlow: false,
126
- messageFlow: false,
127
- association: false,
128
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
129
- });
130
- }));
131
-
132
-
133
- it('connect DataObjectReference -> EndEvent_None', inject(function() {
134
-
135
- expectCanConnect('DataObjectReference', 'EndEvent_None', {
136
- sequenceFlow: false,
137
- messageFlow: false,
138
- association: false,
139
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
140
- });
141
- }));
142
-
143
-
144
- it('connect EndEvent_None -> DataObjectReference', inject(function() {
145
-
146
- expectCanConnect('EndEvent_None', 'DataObjectReference', {
147
- sequenceFlow: false,
148
- messageFlow: false,
149
- association: false,
150
- dataAssociation: false
151
- });
152
- }));
153
-
154
-
155
- it('connect Task -> DataObjectReference', inject(function() {
156
-
157
- expectCanConnect('Task', 'DataObjectReference', {
158
- sequenceFlow: false,
159
- messageFlow: false,
160
- association: false,
161
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
162
- });
163
- }));
164
-
165
-
166
- it('connect DataObjectReference -> Task', inject(function() {
167
-
168
- expectCanConnect('DataObjectReference', 'Task', {
169
- sequenceFlow: false,
170
- messageFlow: false,
171
- association: false,
172
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
173
- });
174
- }));
175
-
176
-
177
- it('connect SubProcess -> DataObjectReference', inject(function() {
178
-
179
- expectCanConnect('SubProcess', 'DataObjectReference', {
180
- sequenceFlow: false,
181
- messageFlow: false,
182
- association: false,
183
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
184
- });
185
- }));
186
-
187
-
188
- it('connect DataObjectReference -> SubProcess', inject(function() {
189
-
190
- expectCanConnect('DataObjectReference', 'SubProcess', {
191
- sequenceFlow: false,
192
- messageFlow: false,
193
- association: false,
194
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
195
- });
196
- }));
197
-
198
-
199
- it('connect DataStoreReference -> StartEvent_None', inject(function() {
200
-
201
- expectCanConnect('DataStoreReference', 'StartEvent_None', {
202
- sequenceFlow: false,
203
- messageFlow: false,
204
- association: false,
205
- dataAssociation: false
206
- });
207
- }));
208
-
209
-
210
- it('connect StartEvent_None -> DataStoreReference', inject(function() {
211
-
212
- expectCanConnect('StartEvent_None', 'DataStoreReference', {
213
- sequenceFlow: false,
214
- messageFlow: false,
215
- association: false,
216
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
217
- });
218
- }));
219
-
220
-
221
- it('connect DataStoreReference -> EndEvent_None', inject(function() {
222
-
223
- expectCanConnect('DataStoreReference', 'EndEvent_None', {
224
- sequenceFlow: false,
225
- messageFlow: false,
226
- association: false,
227
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
228
- });
229
- }));
230
-
231
-
232
- it('connect EndEvent_None -> DataStoreReference', inject(function() {
233
-
234
- expectCanConnect('EndEvent_None', 'DataStoreReference', {
235
- sequenceFlow: false,
236
- messageFlow: false,
237
- association: false,
238
- dataAssociation: false
239
- });
240
- }));
241
-
242
-
243
- it('connect Task -> DataStoreReference', inject(function() {
244
-
245
- expectCanConnect('Task', 'DataStoreReference', {
246
- sequenceFlow: false,
247
- messageFlow: false,
248
- association: false,
249
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
250
- });
251
- }));
252
-
253
-
254
- it('connect DataStoreReference -> Task', inject(function() {
255
-
256
- expectCanConnect('DataStoreReference', 'Task', {
257
- sequenceFlow: false,
258
- messageFlow: false,
259
- association: false,
260
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
261
- });
262
- }));
263
-
264
-
265
- it('connect SubProcess -> DataStoreReference', inject(function() {
266
-
267
- expectCanConnect('SubProcess', 'DataStoreReference', {
268
- sequenceFlow: false,
269
- messageFlow: false,
270
- association: false,
271
- dataAssociation: { type: 'bpmn:DataOutputAssociation' }
272
- });
273
- }));
274
-
275
-
276
- it('connect DataStoreReference -> SubProcess', inject(function() {
277
-
278
- expectCanConnect('DataStoreReference', 'SubProcess', {
279
- sequenceFlow: false,
280
- messageFlow: false,
281
- association: false,
282
- dataAssociation: { type: 'bpmn:DataInputAssociation' }
283
- });
284
- }));
285
-
286
- });
287
-
288
-
289
- describe('boundary events', function() {
290
-
291
- var testXML = require('./BpmnRules.boundaryEvent.bpmn');
292
-
293
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
294
-
295
-
296
- it('connect BoundaryEvent_on_SubProcess -> Task', inject(function() {
297
-
298
- expectCanConnect('BoundaryEvent_on_SubProcess', 'Task', {
299
- sequenceFlow: true,
300
- messageFlow: false,
301
- association: false,
302
- dataAssociation: false
303
- });
304
- }));
305
-
306
-
307
- it('connect BoundaryEvent_on_SubProcess -> ExclusiveGateway', inject(function() {
308
-
309
- expectCanConnect('BoundaryEvent_on_SubProcess', 'ExclusiveGateway', {
310
- sequenceFlow: true,
311
- messageFlow: false,
312
- association: false,
313
- dataAssociation: false
314
- });
315
- }));
316
-
317
-
318
- it('connect BoundaryEvent_on_SubProcess -> SubProcess', inject(function() {
319
-
320
- expectCanConnect('BoundaryEvent_on_SubProcess', 'SubProcess', {
321
- sequenceFlow: true,
322
- messageFlow: false,
323
- association: false,
324
- dataAssociation: false
325
- });
326
- }));
327
-
328
-
329
- it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_on_Task', inject(function() {
330
-
331
- expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_on_Task', {
332
- sequenceFlow: false,
333
- messageFlow: false,
334
- association: false,
335
- dataAssociation: false
336
- });
337
- }));
338
-
339
-
340
- it('connect BoundaryEvent_on_SubProcess -> StartEvent_None', inject(function() {
341
-
342
- expectCanConnect('BoundaryEvent_on_SubProcess', 'StartEvent_None', {
343
- sequenceFlow: false,
344
- messageFlow: false,
345
- association: false,
346
- dataAssociation: false
347
- });
348
- }));
349
-
350
-
351
- it('connect StartEvent_None -> BoundaryEvent_on_SubProcess', inject(function() {
352
-
353
- expectCanConnect('StartEvent_None', 'BoundaryEvent_on_SubProcess', {
354
- sequenceFlow: false,
355
- messageFlow: false,
356
- association: false,
357
- dataAssociation: false
358
- });
359
- }));
360
-
361
-
362
- it('connect BoundaryEvent_nested -> Task', inject(function() {
363
-
364
- expectCanConnect('BoundaryEvent_nested', 'Task', {
365
- sequenceFlow: false,
366
- messageFlow: false,
367
- association: false,
368
- dataAssociation: false
369
- });
370
- }));
371
-
372
-
373
- it('connect BoundaryEvent_nested -> EndEvent_nested', inject(function() {
374
-
375
- expectCanConnect('BoundaryEvent_nested', 'EndEvent_nested', {
376
- sequenceFlow: true,
377
- messageFlow: false,
378
- association: false,
379
- dataAssociation: false
380
- });
381
- }));
382
-
383
-
384
- it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_in_OtherProcess', inject(function() {
385
-
386
- expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_in_OtherProcess', {
387
- sequenceFlow: false,
388
- messageFlow: false,
389
- association: false,
390
- dataAssociation: false
391
- });
392
- }));
393
-
394
-
395
- it('connect BoundaryEvent_on_SubProcess -> Task_in_OtherProcess', inject(function() {
396
-
397
- expectCanConnect('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', {
398
- sequenceFlow: false,
399
- messageFlow: false,
400
- association: false,
401
- dataAssociation: false
402
- });
403
- }));
404
-
405
-
406
- it('connect Task_in_OtherProcess -> BoundaryEvent_on_SubProcess', inject(function() {
407
-
408
- expectCanConnect('Task_in_OtherProcess', 'BoundaryEvent_on_SubProcess', {
409
- sequenceFlow: false,
410
- messageFlow: true,
411
- association: false,
412
- dataAssociation: false
413
- });
414
- }));
415
-
416
- });
417
-
418
-
419
- describe('event based gateway', function() {
420
-
421
- var testXML = require('./BpmnRules.eventBasedGateway.bpmn');
422
-
423
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
424
-
425
-
426
- it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
427
-
428
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
429
- sequenceFlow: true,
430
- messageFlow: false,
431
- association: false,
432
- dataAssociation: false
433
- });
434
- }));
435
-
436
-
437
- it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
438
-
439
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
440
- sequenceFlow: true,
441
- messageFlow: false,
442
- association: false,
443
- dataAssociation: false
444
- });
445
- }));
446
-
447
-
448
- it('connect EventBasedGateway -> IntermediateCatchEvent_Signal', inject(function() {
449
-
450
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Signal', {
451
- sequenceFlow: true,
452
- messageFlow: false,
453
- association: false,
454
- dataAssociation: false
455
- });
456
- }));
457
-
458
-
459
- it('connect EventBasedGateway -> IntermediateCatchEvent_Condition', inject(function() {
460
-
461
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Condition', {
462
- sequenceFlow: true,
463
- messageFlow: false,
464
- association: false,
465
- dataAssociation: false
466
- });
467
- }));
468
-
469
-
470
- it('connect EventBasedGateway -> IntermediateCatchEvent_Timer', inject(function() {
471
-
472
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Timer', {
473
- sequenceFlow: true,
474
- messageFlow: false,
475
- association: false,
476
- dataAssociation: false
477
- });
478
- }));
479
-
480
-
481
- it('connect EventBasedGateway -> IntermediateCatchEvent', inject(function() {
482
-
483
- expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent', {
484
- sequenceFlow: false,
485
- messageFlow: false,
486
- association: false,
487
- dataAssociation: false
488
- });
489
- }));
490
-
491
-
492
- it('connect EventBasedGateway -> IntermediateThrowEvent_Message', inject(function() {
493
-
494
- expectCanConnect('EventBasedGateway', 'IntermediateThrowEvent_Message', {
495
- sequenceFlow: false,
496
- messageFlow: false,
497
- association: false,
498
- dataAssociation: false
499
- });
500
- }));
501
-
502
-
503
- it('connect EventBasedGateway -> ReceiveTask', inject(function() {
504
-
505
- expectCanConnect('EventBasedGateway', 'ReceiveTask', {
506
- sequenceFlow: true,
507
- messageFlow: false,
508
- association: false,
509
- dataAssociation: false
510
- });
511
- }));
512
-
513
-
514
- it('connect EventBasedGateway -> Task_None', inject(function() {
515
-
516
- expectCanConnect('EventBasedGateway', 'Task_None', {
517
- sequenceFlow: false,
518
- messageFlow: false,
519
- association: false,
520
- dataAssociation: false
521
- });
522
- }));
523
-
524
-
525
- it('connect EventBasedGateway -> ParallelGateway', inject(function() {
526
-
527
- expectCanConnect('EventBasedGateway', 'ParallelGateway', {
528
- sequenceFlow: false,
529
- messageFlow: false,
530
- association: false,
531
- dataAssociation: false
532
- });
533
- }));
534
-
535
-
536
- it('connect EventBasedGateway -> ParallelGateway', inject(function() {
537
-
538
- expectCanConnect('EventBasedGateway', 'ParallelGateway', {
539
- sequenceFlow: false,
540
- messageFlow: false,
541
- association: false,
542
- dataAssociation: false
543
- });
544
- }));
545
-
546
- });
547
-
548
-
549
- describe('compensation', function() {
550
-
551
- var testXML = require('./BpmnRules.compensation.bpmn');
552
-
553
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
554
-
555
-
556
- it('connect CompensationBoundary -> Task', inject(function() {
557
-
558
- expectCanConnect('CompensationBoundary', 'Task', {
559
- sequenceFlow: false,
560
- messageFlow: false,
561
- association: false,
562
- dataAssociation: false
563
- });
564
- }));
565
-
566
-
567
- it('connect CompensationBoundary -> TaskForCompensation', inject(function() {
568
-
569
- expectCanConnect('CompensationBoundary', 'TaskForCompensation', {
570
- sequenceFlow: false,
571
- messageFlow: false,
572
- association: true,
573
- dataAssociation: false
574
- });
575
-
576
- }));
577
-
578
-
579
- it('connect CompensationBoundary -> Gateway', inject(function() {
580
-
581
- expectCanConnect('CompensationBoundary', 'Gateway', {
582
- sequenceFlow: false,
583
- messageFlow: false,
584
- association: false,
585
- dataAssociation: false
586
- });
587
-
588
- }));
589
-
590
-
591
- it('connect CompensationBoundary -> IntermediateEvent', inject(function() {
592
-
593
- expectCanConnect('CompensationBoundary', 'IntermediateEvent', {
594
- sequenceFlow: false,
595
- messageFlow: false,
596
- association: false,
597
- dataAssociation: false
598
- });
599
-
600
- }));
601
-
602
-
603
- it('connect Task -> TaskForCompensation', inject(function() {
604
-
605
- expectCanConnect('Task', 'TaskForCompensation', {
606
- sequenceFlow: false,
607
- messageFlow: false,
608
- association: false,
609
- dataAssociation: false
610
- });
611
-
612
- }));
613
-
614
-
615
- it('connect TaskForCompensation -> Task', inject(function() {
616
-
617
- expectCanConnect('TaskForCompensation', 'Task', {
618
- sequenceFlow: false,
619
- messageFlow: false,
620
- association: false,
621
- dataAssociation: false
622
- });
623
-
624
- }));
625
-
626
- });
627
-
628
-
629
- describe('on collaboration diagram', function() {
630
-
631
- var testXML = require('./BpmnRules.collaboration.bpmn');
632
-
633
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
634
-
635
-
636
- it('connect StartEvent_None -> IntermediateEvent', inject(function() {
637
-
638
- expectCanConnect('StartEvent_None', 'IntermediateThrowEvent_Message', {
639
- sequenceFlow: true,
640
- messageFlow: false,
641
- association: false,
642
- dataAssociation: false
643
- });
644
- }));
645
-
646
-
647
- it('connect StartEvent_None -> OtherParticipant', inject(function() {
648
-
649
- expectCanConnect('StartEvent_None', 'OtherParticipant', {
650
- sequenceFlow: false,
651
- messageFlow: false,
652
- association: false,
653
- dataAssociation: false
654
- });
655
- }));
656
-
657
-
658
- it('connect OtherParticipant -> StartEvent_None', inject(function() {
659
-
660
- expectCanConnect('OtherParticipant', 'StartEvent_None', {
661
- sequenceFlow: false,
662
- messageFlow: true,
663
- association: false,
664
- dataAssociation: false
665
- });
666
-
667
- }));
668
-
669
-
670
- it('connect OtherParticipant -> StartEvent_Timer', inject(function() {
671
-
672
- expectCanConnect('OtherParticipant', 'StartEvent_Timer', {
673
- sequenceFlow: false,
674
- messageFlow: false,
675
- association: false,
676
- dataAssociation: false
677
- });
678
-
679
- }));
680
-
681
-
682
- it('connect OtherParticipant -> StartEvent_Message', inject(function() {
683
-
684
- expectCanConnect('OtherParticipant', 'StartEvent_Message', {
685
- sequenceFlow: false,
686
- messageFlow: true,
687
- association: false,
688
- dataAssociation: false
689
- });
690
-
691
- }));
692
-
693
-
694
- it('connect EndEvent_None -> OtherParticipant', inject(function() {
695
-
696
- expectCanConnect('EndEvent_None', 'OtherParticipant', {
697
- sequenceFlow: false,
698
- messageFlow: true,
699
- association: false,
700
- dataAssociation: false
701
- });
702
- }));
703
-
704
-
705
- it('connect EndEvent_Cancel -> OtherParticipant', inject(function() {
706
-
707
- expectCanConnect('EndEvent_Cancel', 'OtherParticipant', {
708
- sequenceFlow: false,
709
- messageFlow: false,
710
- association: false,
711
- dataAssociation: false
712
- });
713
- }));
714
-
715
-
716
- it('connect EndEvent_Message -> OtherParticipant', inject(function() {
717
-
718
- expectCanConnect('EndEvent_Message', 'OtherParticipant', {
719
- sequenceFlow: false,
720
- messageFlow: true,
721
- association: false,
722
- dataAssociation: false
723
- });
724
- }));
725
-
726
-
727
- it('connect OtherParticipant -> EndEvent_None', inject(function() {
728
-
729
- expectCanConnect('OtherParticipant', 'EndEvent_None', {
730
- sequenceFlow: false,
731
- messageFlow: false,
732
- association: false,
733
- dataAssociation: false
734
- });
735
- }));
736
-
737
-
738
- it('connect IntermediateThrowEvent_Message -> OtherParticipant', inject(function() {
739
-
740
- expectCanConnect('IntermediateThrowEvent_Message', 'OtherParticipant', {
741
- sequenceFlow: false,
742
- messageFlow: true,
743
- association: false,
744
- dataAssociation: false
745
- });
746
- }));
747
-
748
-
749
- it('connect IntermediateThrowEvent_None -> OtherParticipant', inject(function() {
750
-
751
- expectCanConnect('IntermediateThrowEvent_None', 'OtherParticipant', {
752
- sequenceFlow: false,
753
- messageFlow: true,
754
- association: false,
755
- dataAssociation: false
756
- });
757
- }));
758
-
759
-
760
- it('connect IntermediateThrowEvent_Signal -> OtherParticipant', inject(function() {
761
-
762
- expectCanConnect('IntermediateThrowEvent_Signal', 'OtherParticipant', {
763
- sequenceFlow: false,
764
- messageFlow: false,
765
- association: false,
766
- dataAssociation: false
767
- });
768
- }));
769
-
770
-
771
- it('connect OtherParticipant -> IntermediateThrowEvent_Message', inject(function() {
772
-
773
- expectCanConnect('OtherParticipant', 'IntermediateThrowEvent_Message', {
774
- sequenceFlow: false,
775
- messageFlow: false,
776
- association: false,
777
- dataAssociation: false
778
- });
779
- }));
780
-
781
-
782
- it('connect Task_in_SubProcess -> OtherParticipant', inject(function() {
783
-
784
- expectCanConnect('Task_in_SubProcess', 'OtherParticipant', {
785
- sequenceFlow: false,
786
- messageFlow: true,
787
- association: false,
788
- dataAssociation: false
789
- });
790
- }));
791
-
792
-
793
- it('connect EndEvent_None_in_SubProcess -> OtherParticipant', inject(function() {
794
-
795
- expectCanConnect('EndEvent_None_in_SubProcess', 'OtherParticipant', {
796
- sequenceFlow: false,
797
- messageFlow: true,
798
- association: false,
799
- dataAssociation: false
800
- });
801
- }));
802
-
803
-
804
- it('connect OtherParticipant -> Task_in_SubProcess', inject(function() {
805
-
806
- expectCanConnect('OtherParticipant', 'Task_in_SubProcess', {
807
- sequenceFlow: false,
808
- messageFlow: true,
809
- association: false,
810
- dataAssociation: false
811
- });
812
- }));
813
-
814
-
815
- it('connect Participant -> OtherParticipant', inject(function() {
816
-
817
- expectCanConnect('Participant', 'OtherParticipant', {
818
- sequenceFlow: false,
819
- messageFlow: true,
820
- association: false,
821
- dataAssociation: false
822
- });
823
- }));
824
-
825
-
826
- it('connect StartEvent_None -> TextAnnotation_OtherParticipant', inject(function() {
827
-
828
- expectCanConnect('StartEvent_None', 'TextAnnotation_OtherParticipant', {
829
- sequenceFlow: false,
830
- messageFlow: false,
831
- association: true,
832
- dataAssociation: false
833
- });
834
- }));
835
-
836
-
837
- it('drop TextAnnotation_Global -> Participant', inject(function() {
838
-
839
- expectCanDrop('TextAnnotation_Global', 'Participant', true);
840
- }));
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
-
849
- });
850
-
851
-
852
- describe('message flows', function() {
853
-
854
- var testXML = require('./BpmnRules.messageFlow.bpmn');
855
-
856
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
857
-
858
-
859
- it('drop MessageFlow -> Collaboration', inject(function() {
860
-
861
- expectCanDrop('MessageFlow', 'Collaboration', true);
862
- }));
863
-
864
- });
865
-
866
-
867
- describe('data association move', function() {
868
-
869
- describe('on process diagram', function() {
870
-
871
- var testXML = require('./BpmnRules.dataAssociation.bpmn');
872
-
873
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
874
-
875
-
876
- it('move selection including data association', inject(function(elementRegistry) {
877
-
878
- // when
879
- var elements = [
880
- elementRegistry.get('Task'),
881
- elementRegistry.get('DataAssociation'),
882
- elementRegistry.get('DataObjectReference')
883
- ];
884
-
885
- // then
886
- expectCanMove(elements, 'Process', {
887
- attach: false,
888
- move: true
889
- });
890
- }));
891
-
892
- });
893
-
894
-
895
- describe('on sub process', function() {
896
-
897
- var testXML = require('./BpmnRules.subProcess-dataAssociation.bpmn');
898
-
899
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
900
-
901
-
902
- it('move task and data association', inject(function(elementRegistry) {
903
-
904
- // when
905
- var elements = [
906
- elementRegistry.get('DataInputAssociation'),
907
- elementRegistry.get('DataOutputAssociation'),
908
- elementRegistry.get('DataStoreReference'),
909
- elementRegistry.get('Task')
910
- ];
911
-
912
- // then
913
- expectCanMove(elements, 'SubProcess', {
914
- attach: false,
915
- move: true
916
- });
917
- }));
918
- });
919
-
920
-
921
- describe('on collaboration', function() {
922
-
923
- var testXML = require('./BpmnRules.collaboration-dataAssociation.bpmn');
924
-
925
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
926
-
927
-
928
- it('move participant and data association', inject(function(elementRegistry) {
929
-
930
- // when
931
- var elements = [
932
- elementRegistry.get('DataInputAssociation'),
933
- elementRegistry.get('Participant')
934
- ];
935
-
936
- // then
937
- expectCanMove(elements, 'Collaboration', {
938
- attach: false,
939
- move: true
940
- });
941
- }));
942
- });
943
-
944
- });
945
-
946
-
947
- describe('multi selection move', function() {
948
-
949
- var testXML = require('./BpmnRules.multiSelectionPools.bpmn');
950
-
951
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
952
-
953
- it('is allowed across pools when parent does not change', inject(function(elementRegistry) {
954
-
955
- // when
956
- var elements = [
957
- elementRegistry.get('Task_A'),
958
- elementRegistry.get('Task_B'),
959
- elementRegistry.get('MessageFlow_1v3u2fb')
960
- ];
961
-
962
- var target = 'Participant_1';
963
-
964
- // then
965
- expectCanMove(elements, target, {
966
- attach: false,
967
- move: true
968
- });
969
- }));
970
- });
971
-
972
- describe('event move', function() {
973
-
974
- var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
975
-
976
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
977
-
978
-
979
- it('attach/move BoundaryEvent -> Process', inject(function(elementRegistry) {
980
-
981
- // when
982
- var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
983
-
984
- var elements = [ boundaryEvent ];
985
-
986
- // then
987
- expectCanMove(elements, 'Process_1', {
988
- attach: false,
989
- move: false
990
- });
991
-
992
- }));
993
-
994
-
995
- it('attach/move BoundaryEvent -> Task', inject(function(elementRegistry) {
996
-
997
- // when
998
- var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
999
-
1000
- var elements = [ boundaryEvent ];
1001
-
1002
- // then
1003
- expectCanMove(elements, 'Task_2', {
1004
- attach: 'attach',
1005
- move: false
1006
- });
1007
-
1008
- }));
1009
-
1010
-
1011
- it('attach/move BoundaryEvent label -> SubProcess', inject(function(elementRegistry) {
1012
-
1013
- // when
1014
- var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1015
- label = boundaryEvent.label;
1016
-
1017
- var elements = [ label ];
1018
-
1019
- // then
1020
- expectCanMove(elements, 'SubProcess_1', {
1021
- attach: false,
1022
- move: true
1023
- });
1024
-
1025
- }));
1026
-
1027
-
1028
- it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function(elementRegistry) {
1029
- // when
1030
- var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1031
- boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
1032
-
1033
- // we assume boundary events and labels
1034
- // to be already filtered during move
1035
- var elements = [ boundaryEvent, boundaryEvent2 ];
1036
-
1037
- // then
1038
- expectCanMove(elements, 'SubProcess_1', {
1039
- attach: false,
1040
- move: false
1041
- });
1042
- }));
1043
-
1044
-
1045
- it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function(elementRegistry) {
1046
- // when
1047
- var subProcess = elementRegistry.get('SubProcess_1'),
1048
- boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1049
- label = boundaryEvent.label;
1050
-
1051
- // we assume boundary events and labels
1052
- // to be already filtered during move
1053
- var elements = [ subProcess, boundaryEvent, label ];
1054
-
1055
- // then
1056
- expectCanMove(elements, 'Process_1', {
1057
- attach: false,
1058
- move: false
1059
- });
1060
- }));
1061
-
1062
- });
1063
-
1064
-
1065
- describe('event create', function() {
1066
-
1067
- var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
1068
-
1069
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1070
-
1071
-
1072
- it('attach IntermediateEvent to Task', inject(function(elementFactory) {
1073
-
1074
- // given
1075
- var eventShape = elementFactory.createShape({
1076
- type: 'bpmn:IntermediateThrowEvent',
1077
- x: 413, y: 254
1078
- });
1079
-
1080
- // then
1081
- expectCanMove([ eventShape ], 'Task_1', {
1082
- attach: 'attach',
1083
- move: false
1084
- });
1085
- }));
1086
-
1087
-
1088
- it('not attach IntermediateEvent to CompensationTask', inject(function(elementFactory) {
1089
-
1090
- // given
1091
- var eventShape = elementFactory.createShape({
1092
- type: 'bpmn:IntermediateThrowEvent',
1093
- x: 413, y: 254
1094
- });
1095
-
1096
- // then
1097
- expectCanMove([ eventShape ], 'CompensationTask', {
1098
- attach: false,
1099
- move: false
1100
- });
1101
- }));
1102
-
1103
-
1104
- it('attach IntermediateEvent to SubProcess inner', inject(function(elementFactory, elementRegistry, bpmnRules) {
1105
-
1106
- // given
1107
- var subProcessElement = elementRegistry.get('SubProcess_1');
1108
- var eventShape = elementFactory.createShape({
1109
- type: 'bpmn:IntermediateThrowEvent',
1110
- x: 413, y: 350
1111
- });
1112
-
1113
- var position = {
1114
- x: subProcessElement.x + subProcessElement.width / 2,
1115
- y: subProcessElement.y + subProcessElement.height / 2
1116
- };
1117
-
1118
- // when
1119
- var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
1120
-
1121
- // then
1122
- expect(canAttach).to.be.false;
1123
- }));
1124
-
1125
-
1126
- it('attach IntermediateEvent to SubProcess border', inject(function(elementFactory, elementRegistry, bpmnRules) {
1127
-
1128
- // given
1129
- var subProcessElement = elementRegistry.get('SubProcess_1');
1130
- var eventShape = elementFactory.createShape({
1131
- type: 'bpmn:IntermediateThrowEvent',
1132
- x: 0, y: 0
1133
- });
1134
-
1135
- var position = {
1136
- x: subProcessElement.x + subProcessElement.width / 2,
1137
- y: subProcessElement.y + subProcessElement.height
1138
- };
1139
-
1140
- // when
1141
- var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
1142
-
1143
- // then
1144
- expect(canAttach).to.equal('attach');
1145
- }));
1146
-
1147
-
1148
- it('not attach IntermediateEvent to compensation activity', inject(function(elementFactory, elementRegistry, bpmnRules) {
1149
-
1150
- // given
1151
- var compensationTask = elementRegistry.get('CompensationTask');
1152
- var eventShape = elementFactory.createShape({
1153
- type: 'bpmn:IntermediateThrowEvent',
1154
- x: 0, y: 0
1155
- });
1156
-
1157
- var position = {
1158
- x: compensationTask.x + compensationTask.width / 2,
1159
- y: compensationTask.y + compensationTask.height
1160
- };
1161
-
1162
- // when
1163
- var canAttach = bpmnRules.canAttach([ eventShape ], compensationTask, null, position);
1164
-
1165
- // then
1166
- expect(canAttach).to.be.false;
1167
- }));
1168
-
1169
-
1170
- it('create IntermediateEvent in SubProcess body', inject(function(elementFactory, elementRegistry, bpmnRules) {
1171
-
1172
- // given
1173
- var subProcessElement = elementRegistry.get('SubProcess_1');
1174
- var eventShape = elementFactory.createShape({
1175
- type: 'bpmn:IntermediateThrowEvent',
1176
- x: 413, y: 250
1177
- });
1178
-
1179
- var position = {
1180
- x: eventShape.x,
1181
- y: eventShape.y
1182
- };
1183
-
1184
- // when
1185
- var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position),
1186
- canCreate = bpmnRules.canCreate(eventShape, subProcessElement, null, position);
1187
-
1188
- // then
1189
- expect(canAttach).to.be.false;
1190
- expect(canCreate).to.be.true;
1191
- }));
1192
-
1193
- });
1194
-
1195
-
1196
- describe('event append', function() {
1197
-
1198
- var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
1199
-
1200
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1201
-
1202
-
1203
- it('append IntermediateEvent from Task', inject(function(elementFactory, elementRegistry, bpmnRules) {
1204
-
1205
- // given
1206
- var subProcessElement = elementRegistry.get('SubProcess_1'),
1207
- taskElement = elementRegistry.get('Task_2');
1208
-
1209
- var eventShape = elementFactory.createShape({
1210
- type: 'bpmn:IntermediateThrowEvent',
1211
- x: 413, y: 250
1212
- });
1213
-
1214
- var position = {
1215
- x: eventShape.x,
1216
- y: eventShape.y
1217
- };
1218
-
1219
- // when
1220
- var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, taskElement, position),
1221
- canCreate = bpmnRules.canCreate(eventShape, subProcessElement, taskElement, position);
1222
-
1223
- // then
1224
- expect(canAttach).to.be.false;
1225
- expect(canCreate).to.be.true;
1226
- }));
1227
-
1228
-
1229
- it('append IntermediateEvent from BoundaryEvent', inject(function(elementFactory, elementRegistry, bpmnRules) {
1230
-
1231
- // given
1232
- var boundaryElement = elementRegistry.get('BoundaryEvent_1'),
1233
- taskElement = elementRegistry.get('Task_2');
1234
-
1235
- var eventShape = elementFactory.createShape({
1236
- type: 'bpmn:IntermediateThrowEvent',
1237
- x: 413, y: 250
1238
- });
1239
-
1240
- // when
1241
- var canAttach = bpmnRules.canAttach([ eventShape ], taskElement, boundaryElement),
1242
- canCreate = bpmnRules.canCreate(eventShape, taskElement, boundaryElement);
1243
-
1244
- // then
1245
- expect(canAttach).to.be.false;
1246
- expect(canCreate).to.be.false;
1247
- }));
1248
-
1249
- });
1250
-
1251
-
1252
- describe('lanes', function() {
1253
-
1254
- var testXML = require('./BpmnRules.collaboration-lanes.bpmn');
1255
-
1256
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1257
-
1258
-
1259
- describe('should add', function() {
1260
-
1261
- it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
1262
-
1263
- // given
1264
- var participantElement = elementRegistry.get('Participant');
1265
-
1266
- var laneShape = elementFactory.createShape({
1267
- type: 'bpmn:Lane',
1268
- x: 413, y: 250
1269
- });
1270
-
1271
- // when
1272
- var canCreate = bpmnRules.canCreate(laneShape, participantElement);
1273
-
1274
- // then
1275
- expect(canCreate).to.be.true;
1276
- }));
1277
-
1278
-
1279
- it('Lane -> Participant_Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1280
-
1281
- // given
1282
- var participantElement = elementRegistry.get('Participant_Lane');
1283
-
1284
- var laneShape = elementFactory.createShape({
1285
- type: 'bpmn:Lane',
1286
- x: 413, y: 250
1287
- });
1288
-
1289
- // when
1290
- var canCreate = bpmnRules.canCreate(laneShape, participantElement);
1291
-
1292
- // then
1293
- expect(canCreate).to.be.true;
1294
- }));
1295
-
1296
-
1297
- it('[not] Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
1298
-
1299
- // given
1300
- var subProcessElement = elementRegistry.get('SubProcess');
1301
-
1302
- var laneShape = elementFactory.createShape({
1303
- type: 'bpmn:Lane',
1304
- x: 413, y: 250
1305
- });
1306
-
1307
- // when
1308
- var canCreate = bpmnRules.canCreate(laneShape, subProcessElement);
1309
-
1310
- // then
1311
- expect(canCreate).to.be.false;
1312
- }));
1313
-
1314
- });
1315
-
1316
-
1317
- describe('should not allow move', function() {
1318
-
1319
- it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
1320
-
1321
- // given
1322
- var participantElement = elementRegistry.get('Participant'),
1323
- laneElement = elementRegistry.get('Lane');
1324
-
1325
- // when
1326
- var canMove = bpmnRules.canMove([ laneElement ], participantElement);
1327
-
1328
- // then
1329
- expect(canMove).to.be.false;
1330
- }));
1331
-
1332
-
1333
- it('Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
1334
-
1335
- // given
1336
- var subProcessElement = elementRegistry.get('SubProcess'),
1337
- laneElement = elementRegistry.get('Lane');
1338
-
1339
- // when
1340
- var canMove = bpmnRules.canMove([ laneElement ], subProcessElement);
1341
-
1342
- // then
1343
- expect(canMove).to.be.false;
1344
- }));
1345
-
1346
- });
1347
-
1348
-
1349
- describe('should resize', function() {
1350
-
1351
- it('Lane', inject(function(bpmnRules, elementRegistry) {
1352
-
1353
- // given
1354
- var laneElement = elementRegistry.get('Lane');
1355
-
1356
- // when
1357
- var canResize = bpmnRules.canResize(laneElement);
1358
-
1359
- // then
1360
- expect(canResize).to.be.true;
1361
- }));
1362
-
1363
- });
1364
-
1365
-
1366
- describe('should allow drop', function() {
1367
-
1368
- it('SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1369
-
1370
- // given
1371
- var element = elementRegistry.get('SubProcess'),
1372
- laneElement = elementRegistry.get('Lane');
1373
-
1374
- // when
1375
- var canMove = bpmnRules.canMove([ element ], laneElement);
1376
-
1377
- // then
1378
- expect(canMove).to.be.true;
1379
- }));
1380
-
1381
-
1382
- it('Task_in_SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1383
-
1384
- // given
1385
- var element = elementRegistry.get('Task_in_SubProcess'),
1386
- laneElement = elementRegistry.get('Lane');
1387
-
1388
- // when
1389
- var canMove = bpmnRules.canMove([ element ], laneElement);
1390
-
1391
- // then
1392
- expect(canMove).to.be.true;
1393
- }));
1394
-
1395
- });
1396
-
1397
- });
1398
-
1399
-
1400
- describe('labels', function() {
1401
-
1402
- var testXML = require('./BpmnRules.process.bpmn');
1403
-
1404
- beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1405
-
1406
-
1407
- it('should filter labels', inject(function(elementRegistry, rules) {
1408
-
1409
- // given
1410
- var startEventShape = elementRegistry.get('StartEvent_None'),
1411
- startEventLabel = startEventShape.label;
1412
-
1413
- // when
1414
- var allowed = rules.allowed('elements.delete', {
1415
- elements: [ startEventShape, startEventLabel ]
1416
- });
1417
-
1418
- // then
1419
- expect(allowed).to.eql([ startEventShape ]);
1420
- }));
1421
-
1422
- });
1423
-
1424
- });
1
+ 'use strict';
2
+
3
+ var Helper = require('./Helper');
4
+
5
+ var expectCanConnect = Helper.expectCanConnect,
6
+ expectCanDrop = Helper.expectCanDrop,
7
+ expectCanMove = Helper.expectCanMove;
8
+
9
+ /* global bootstrapModeler, inject */
10
+
11
+ var modelingModule = require('../../../../lib/features/modeling'),
12
+ coreModule = require('../../../../lib/core');
13
+
14
+
15
+ describe('features/modeling/rules - BpmnRules', function() {
16
+
17
+ var testModules = [ coreModule, modelingModule ];
18
+
19
+
20
+ describe('on process diagram', function() {
21
+
22
+ var testXML = require('./BpmnRules.process.bpmn');
23
+
24
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
25
+
26
+
27
+ it('connect StartEvent_None -> Task', inject(function() {
28
+
29
+ expectCanConnect('StartEvent_None', 'Task', {
30
+ sequenceFlow: true,
31
+ messageFlow: false,
32
+ association: false,
33
+ dataAssociation: false
34
+ });
35
+ }));
36
+
37
+
38
+ it('connect StartEvent_None -> TextAnnotation', inject(function() {
39
+
40
+ expectCanConnect('StartEvent_None', 'TextAnnotation', {
41
+ sequenceFlow: false,
42
+ messageFlow: false,
43
+ association: true,
44
+ dataAssociation: false
45
+ });
46
+ }));
47
+
48
+
49
+ it('connect Task -> IntermediateThrowEvent_Link', inject(function() {
50
+
51
+ expectCanConnect('Task', 'IntermediateThrowEvent_Link', {
52
+ sequenceFlow: true,
53
+ messageFlow: false,
54
+ association: false,
55
+ dataAssociation: false
56
+ });
57
+ }));
58
+
59
+
60
+ it('connect IntermediateThrowEvent_Link -> EndEvent_None', inject(function() {
61
+
62
+ expectCanConnect('IntermediateThrowEvent_Link', 'EndEvent_None', {
63
+ sequenceFlow: false,
64
+ messageFlow: false,
65
+ association: false,
66
+ dataAssociation: false
67
+ });
68
+ }));
69
+
70
+
71
+ it('connect StartEvent_None -> IntermediateCatchEvent_Link', inject(function() {
72
+
73
+ expectCanConnect('StartEvent_None', 'IntermediateCatchEvent_Link', {
74
+ sequenceFlow: false,
75
+ messageFlow: false,
76
+ association: false,
77
+ dataAssociation: false
78
+ });
79
+ }));
80
+
81
+
82
+ it('connect IntermediateCatchEvent_Link -> Task', inject(function() {
83
+
84
+ expectCanConnect('IntermediateCatchEvent_Link', 'Task', {
85
+ sequenceFlow: true,
86
+ messageFlow: false,
87
+ association: false,
88
+ dataAssociation: false
89
+ });
90
+ }));
91
+
92
+
93
+ it('drop TextAnnotation -> Process', inject(function() {
94
+
95
+ expectCanDrop('TextAnnotation', 'Process', true);
96
+ }));
97
+
98
+
99
+ it('drop TextAnnotation -> SubProcess', inject(function() {
100
+
101
+ expectCanDrop('TextAnnotation', 'SubProcess', true);
102
+ }));
103
+
104
+
105
+ it('drop Start Event -> Collapsed Sub Process', function() {
106
+
107
+ expectCanDrop('StartEvent_None', 'CollapsedSubProcess', false);
108
+ });
109
+
110
+
111
+ it('connect DataObjectReference -> StartEvent_None', inject(function() {
112
+
113
+ expectCanConnect('DataObjectReference', 'StartEvent_None', {
114
+ sequenceFlow: false,
115
+ messageFlow: false,
116
+ association: false,
117
+ dataAssociation: false
118
+ });
119
+ }));
120
+
121
+
122
+ it('connect StartEvent_None -> DataObjectReference', inject(function() {
123
+
124
+ expectCanConnect('StartEvent_None', 'DataObjectReference', {
125
+ sequenceFlow: false,
126
+ messageFlow: false,
127
+ association: false,
128
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
129
+ });
130
+ }));
131
+
132
+
133
+ it('connect DataObjectReference -> EndEvent_None', inject(function() {
134
+
135
+ expectCanConnect('DataObjectReference', 'EndEvent_None', {
136
+ sequenceFlow: false,
137
+ messageFlow: false,
138
+ association: false,
139
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
140
+ });
141
+ }));
142
+
143
+
144
+ it('connect EndEvent_None -> DataObjectReference', inject(function() {
145
+
146
+ expectCanConnect('EndEvent_None', 'DataObjectReference', {
147
+ sequenceFlow: false,
148
+ messageFlow: false,
149
+ association: false,
150
+ dataAssociation: false
151
+ });
152
+ }));
153
+
154
+
155
+ it('connect Task -> DataObjectReference', inject(function() {
156
+
157
+ expectCanConnect('Task', 'DataObjectReference', {
158
+ sequenceFlow: false,
159
+ messageFlow: false,
160
+ association: false,
161
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
162
+ });
163
+ }));
164
+
165
+
166
+ it('connect DataObjectReference -> Task', inject(function() {
167
+
168
+ expectCanConnect('DataObjectReference', 'Task', {
169
+ sequenceFlow: false,
170
+ messageFlow: false,
171
+ association: false,
172
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
173
+ });
174
+ }));
175
+
176
+
177
+ it('connect SubProcess -> DataObjectReference', inject(function() {
178
+
179
+ expectCanConnect('SubProcess', 'DataObjectReference', {
180
+ sequenceFlow: false,
181
+ messageFlow: false,
182
+ association: false,
183
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
184
+ });
185
+ }));
186
+
187
+
188
+ it('connect DataObjectReference -> SubProcess', inject(function() {
189
+
190
+ expectCanConnect('DataObjectReference', 'SubProcess', {
191
+ sequenceFlow: false,
192
+ messageFlow: false,
193
+ association: false,
194
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
195
+ });
196
+ }));
197
+
198
+
199
+ it('connect DataStoreReference -> StartEvent_None', inject(function() {
200
+
201
+ expectCanConnect('DataStoreReference', 'StartEvent_None', {
202
+ sequenceFlow: false,
203
+ messageFlow: false,
204
+ association: false,
205
+ dataAssociation: false
206
+ });
207
+ }));
208
+
209
+
210
+ it('connect DataObjectReference -> TextAnnotation', inject(function() {
211
+
212
+ expectCanConnect('DataObjectReference', 'TextAnnotation', {
213
+ sequenceFlow: false,
214
+ messageFlow: false,
215
+ association: true,
216
+ dataAssociation: false
217
+ });
218
+ }));
219
+
220
+
221
+ it('connect TextAnnotation -> DataObjectReference', inject(function() {
222
+
223
+ expectCanConnect('TextAnnotation', 'DataObjectReference', {
224
+ sequenceFlow: false,
225
+ messageFlow: false,
226
+ association: true,
227
+ dataAssociation: false
228
+ });
229
+ }));
230
+
231
+
232
+ it('connect DataStoreReference -> TextAnnotation', inject(function() {
233
+
234
+ expectCanConnect('DataStoreReference', 'TextAnnotation', {
235
+ sequenceFlow: false,
236
+ messageFlow: false,
237
+ association: true,
238
+ dataAssociation: false
239
+ });
240
+ }));
241
+
242
+
243
+ it('connect TextAnnotation -> DataStoreReference', inject(function() {
244
+
245
+ expectCanConnect('TextAnnotation', 'DataStoreReference', {
246
+ sequenceFlow: false,
247
+ messageFlow: false,
248
+ association: true,
249
+ dataAssociation: false
250
+ });
251
+ }));
252
+
253
+
254
+ it('connect StartEvent_None -> DataStoreReference', inject(function() {
255
+
256
+ expectCanConnect('StartEvent_None', 'DataStoreReference', {
257
+ sequenceFlow: false,
258
+ messageFlow: false,
259
+ association: false,
260
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
261
+ });
262
+ }));
263
+
264
+
265
+ it('connect DataStoreReference -> EndEvent_None', inject(function() {
266
+
267
+ expectCanConnect('DataStoreReference', 'EndEvent_None', {
268
+ sequenceFlow: false,
269
+ messageFlow: false,
270
+ association: false,
271
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
272
+ });
273
+ }));
274
+
275
+
276
+ it('connect EndEvent_None -> DataStoreReference', inject(function() {
277
+
278
+ expectCanConnect('EndEvent_None', 'DataStoreReference', {
279
+ sequenceFlow: false,
280
+ messageFlow: false,
281
+ association: false,
282
+ dataAssociation: false
283
+ });
284
+ }));
285
+
286
+
287
+ it('connect Task -> DataStoreReference', inject(function() {
288
+
289
+ expectCanConnect('Task', 'DataStoreReference', {
290
+ sequenceFlow: false,
291
+ messageFlow: false,
292
+ association: false,
293
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
294
+ });
295
+ }));
296
+
297
+
298
+ it('connect DataStoreReference -> Task', inject(function() {
299
+
300
+ expectCanConnect('DataStoreReference', 'Task', {
301
+ sequenceFlow: false,
302
+ messageFlow: false,
303
+ association: false,
304
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
305
+ });
306
+ }));
307
+
308
+
309
+ it('connect SubProcess -> DataStoreReference', inject(function() {
310
+
311
+ expectCanConnect('SubProcess', 'DataStoreReference', {
312
+ sequenceFlow: false,
313
+ messageFlow: false,
314
+ association: false,
315
+ dataAssociation: { type: 'bpmn:DataOutputAssociation' }
316
+ });
317
+ }));
318
+
319
+
320
+ it('connect DataStoreReference -> SubProcess', inject(function() {
321
+
322
+ expectCanConnect('DataStoreReference', 'SubProcess', {
323
+ sequenceFlow: false,
324
+ messageFlow: false,
325
+ association: false,
326
+ dataAssociation: { type: 'bpmn:DataInputAssociation' }
327
+ });
328
+ }));
329
+
330
+ });
331
+
332
+
333
+ describe('boundary events', function() {
334
+
335
+ var testXML = require('./BpmnRules.boundaryEvent.bpmn');
336
+
337
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
338
+
339
+
340
+ it('connect BoundaryEvent_on_SubProcess -> Task', inject(function() {
341
+
342
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'Task', {
343
+ sequenceFlow: true,
344
+ messageFlow: false,
345
+ association: false,
346
+ dataAssociation: false
347
+ });
348
+ }));
349
+
350
+
351
+ it('connect BoundaryEvent_on_SubProcess -> ExclusiveGateway', inject(function() {
352
+
353
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'ExclusiveGateway', {
354
+ sequenceFlow: true,
355
+ messageFlow: false,
356
+ association: false,
357
+ dataAssociation: false
358
+ });
359
+ }));
360
+
361
+
362
+ it('connect BoundaryEvent_on_SubProcess -> SubProcess', inject(function() {
363
+
364
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'SubProcess', {
365
+ sequenceFlow: true,
366
+ messageFlow: false,
367
+ association: false,
368
+ dataAssociation: false
369
+ });
370
+ }));
371
+
372
+
373
+ it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_on_Task', inject(function() {
374
+
375
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_on_Task', {
376
+ sequenceFlow: false,
377
+ messageFlow: false,
378
+ association: false,
379
+ dataAssociation: false
380
+ });
381
+ }));
382
+
383
+
384
+ it('connect BoundaryEvent_on_SubProcess -> StartEvent_None', inject(function() {
385
+
386
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'StartEvent_None', {
387
+ sequenceFlow: false,
388
+ messageFlow: false,
389
+ association: false,
390
+ dataAssociation: false
391
+ });
392
+ }));
393
+
394
+
395
+ it('connect StartEvent_None -> BoundaryEvent_on_SubProcess', inject(function() {
396
+
397
+ expectCanConnect('StartEvent_None', 'BoundaryEvent_on_SubProcess', {
398
+ sequenceFlow: false,
399
+ messageFlow: false,
400
+ association: false,
401
+ dataAssociation: false
402
+ });
403
+ }));
404
+
405
+
406
+ it('connect BoundaryEvent_nested -> Task', inject(function() {
407
+
408
+ expectCanConnect('BoundaryEvent_nested', 'Task', {
409
+ sequenceFlow: false,
410
+ messageFlow: false,
411
+ association: false,
412
+ dataAssociation: false
413
+ });
414
+ }));
415
+
416
+
417
+ it('connect BoundaryEvent_nested -> EndEvent_nested', inject(function() {
418
+
419
+ expectCanConnect('BoundaryEvent_nested', 'EndEvent_nested', {
420
+ sequenceFlow: true,
421
+ messageFlow: false,
422
+ association: false,
423
+ dataAssociation: false
424
+ });
425
+ }));
426
+
427
+
428
+ it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_in_OtherProcess', inject(function() {
429
+
430
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_in_OtherProcess', {
431
+ sequenceFlow: false,
432
+ messageFlow: false,
433
+ association: false,
434
+ dataAssociation: false
435
+ });
436
+ }));
437
+
438
+
439
+ it('connect BoundaryEvent_on_SubProcess -> Task_in_OtherProcess', inject(function() {
440
+
441
+ expectCanConnect('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', {
442
+ sequenceFlow: false,
443
+ messageFlow: false,
444
+ association: false,
445
+ dataAssociation: false
446
+ });
447
+ }));
448
+
449
+
450
+ it('connect Task_in_OtherProcess -> BoundaryEvent_on_SubProcess', inject(function() {
451
+
452
+ expectCanConnect('Task_in_OtherProcess', 'BoundaryEvent_on_SubProcess', {
453
+ sequenceFlow: false,
454
+ messageFlow: true,
455
+ association: false,
456
+ dataAssociation: false
457
+ });
458
+ }));
459
+
460
+ });
461
+
462
+
463
+ describe('event based gateway', function() {
464
+
465
+ var testXML = require('./BpmnRules.eventBasedGateway.bpmn');
466
+
467
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
468
+
469
+
470
+ it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
471
+
472
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
473
+ sequenceFlow: true,
474
+ messageFlow: false,
475
+ association: false,
476
+ dataAssociation: false
477
+ });
478
+ }));
479
+
480
+
481
+ it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
482
+
483
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
484
+ sequenceFlow: true,
485
+ messageFlow: false,
486
+ association: false,
487
+ dataAssociation: false
488
+ });
489
+ }));
490
+
491
+
492
+ it('connect EventBasedGateway -> IntermediateCatchEvent_Signal', inject(function() {
493
+
494
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Signal', {
495
+ sequenceFlow: true,
496
+ messageFlow: false,
497
+ association: false,
498
+ dataAssociation: false
499
+ });
500
+ }));
501
+
502
+
503
+ it('connect EventBasedGateway -> IntermediateCatchEvent_Condition', inject(function() {
504
+
505
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Condition', {
506
+ sequenceFlow: true,
507
+ messageFlow: false,
508
+ association: false,
509
+ dataAssociation: false
510
+ });
511
+ }));
512
+
513
+
514
+ it('connect EventBasedGateway -> IntermediateCatchEvent_Timer', inject(function() {
515
+
516
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Timer', {
517
+ sequenceFlow: true,
518
+ messageFlow: false,
519
+ association: false,
520
+ dataAssociation: false
521
+ });
522
+ }));
523
+
524
+
525
+ it('connect EventBasedGateway -> IntermediateCatchEvent', inject(function() {
526
+
527
+ expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent', {
528
+ sequenceFlow: false,
529
+ messageFlow: false,
530
+ association: false,
531
+ dataAssociation: false
532
+ });
533
+ }));
534
+
535
+
536
+ it('connect EventBasedGateway -> IntermediateThrowEvent_Message', inject(function() {
537
+
538
+ expectCanConnect('EventBasedGateway', 'IntermediateThrowEvent_Message', {
539
+ sequenceFlow: false,
540
+ messageFlow: false,
541
+ association: false,
542
+ dataAssociation: false
543
+ });
544
+ }));
545
+
546
+
547
+ it('connect EventBasedGateway -> ReceiveTask', inject(function() {
548
+
549
+ expectCanConnect('EventBasedGateway', 'ReceiveTask', {
550
+ sequenceFlow: true,
551
+ messageFlow: false,
552
+ association: false,
553
+ dataAssociation: false
554
+ });
555
+ }));
556
+
557
+
558
+ it('connect EventBasedGateway -> Task_None', inject(function() {
559
+
560
+ expectCanConnect('EventBasedGateway', 'Task_None', {
561
+ sequenceFlow: false,
562
+ messageFlow: false,
563
+ association: false,
564
+ dataAssociation: false
565
+ });
566
+ }));
567
+
568
+
569
+ it('connect EventBasedGateway -> ParallelGateway', inject(function() {
570
+
571
+ expectCanConnect('EventBasedGateway', 'ParallelGateway', {
572
+ sequenceFlow: false,
573
+ messageFlow: false,
574
+ association: false,
575
+ dataAssociation: false
576
+ });
577
+ }));
578
+
579
+
580
+ it('connect EventBasedGateway -> ParallelGateway', inject(function() {
581
+
582
+ expectCanConnect('EventBasedGateway', 'ParallelGateway', {
583
+ sequenceFlow: false,
584
+ messageFlow: false,
585
+ association: false,
586
+ dataAssociation: false
587
+ });
588
+ }));
589
+
590
+ });
591
+
592
+
593
+ describe('compensation', function() {
594
+
595
+ var testXML = require('./BpmnRules.compensation.bpmn');
596
+
597
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
598
+
599
+
600
+ it('connect CompensationBoundary -> Task', inject(function() {
601
+
602
+ expectCanConnect('CompensationBoundary', 'Task', {
603
+ sequenceFlow: false,
604
+ messageFlow: false,
605
+ association: false,
606
+ dataAssociation: false
607
+ });
608
+ }));
609
+
610
+
611
+ it('connect CompensationBoundary -> TaskForCompensation', inject(function() {
612
+
613
+ expectCanConnect('CompensationBoundary', 'TaskForCompensation', {
614
+ sequenceFlow: false,
615
+ messageFlow: false,
616
+ association: true,
617
+ dataAssociation: false
618
+ });
619
+
620
+ }));
621
+
622
+
623
+ it('connect CompensationBoundary -> Gateway', inject(function() {
624
+
625
+ expectCanConnect('CompensationBoundary', 'Gateway', {
626
+ sequenceFlow: false,
627
+ messageFlow: false,
628
+ association: false,
629
+ dataAssociation: false
630
+ });
631
+
632
+ }));
633
+
634
+
635
+ it('connect CompensationBoundary -> IntermediateEvent', inject(function() {
636
+
637
+ expectCanConnect('CompensationBoundary', 'IntermediateEvent', {
638
+ sequenceFlow: false,
639
+ messageFlow: false,
640
+ association: false,
641
+ dataAssociation: false
642
+ });
643
+
644
+ }));
645
+
646
+
647
+ it('connect Task -> TaskForCompensation', inject(function() {
648
+
649
+ expectCanConnect('Task', 'TaskForCompensation', {
650
+ sequenceFlow: false,
651
+ messageFlow: false,
652
+ association: false,
653
+ dataAssociation: false
654
+ });
655
+
656
+ }));
657
+
658
+
659
+ it('connect TaskForCompensation -> Task', inject(function() {
660
+
661
+ expectCanConnect('TaskForCompensation', 'Task', {
662
+ sequenceFlow: false,
663
+ messageFlow: false,
664
+ association: false,
665
+ dataAssociation: false
666
+ });
667
+
668
+ }));
669
+
670
+ });
671
+
672
+
673
+ describe('on collaboration diagram', function() {
674
+
675
+ var testXML = require('./BpmnRules.collaboration.bpmn');
676
+
677
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
678
+
679
+
680
+ it('connect StartEvent_None -> IntermediateEvent', inject(function() {
681
+
682
+ expectCanConnect('StartEvent_None', 'IntermediateThrowEvent_Message', {
683
+ sequenceFlow: true,
684
+ messageFlow: false,
685
+ association: false,
686
+ dataAssociation: false
687
+ });
688
+ }));
689
+
690
+
691
+ it('connect StartEvent_None -> OtherParticipant', inject(function() {
692
+
693
+ expectCanConnect('StartEvent_None', 'OtherParticipant', {
694
+ sequenceFlow: false,
695
+ messageFlow: false,
696
+ association: false,
697
+ dataAssociation: false
698
+ });
699
+ }));
700
+
701
+
702
+ it('connect OtherParticipant -> StartEvent_None', inject(function() {
703
+
704
+ expectCanConnect('OtherParticipant', 'StartEvent_None', {
705
+ sequenceFlow: false,
706
+ messageFlow: true,
707
+ association: false,
708
+ dataAssociation: false
709
+ });
710
+
711
+ }));
712
+
713
+
714
+ it('connect OtherParticipant -> StartEvent_Timer', inject(function() {
715
+
716
+ expectCanConnect('OtherParticipant', 'StartEvent_Timer', {
717
+ sequenceFlow: false,
718
+ messageFlow: false,
719
+ association: false,
720
+ dataAssociation: false
721
+ });
722
+
723
+ }));
724
+
725
+
726
+ it('connect OtherParticipant -> StartEvent_Message', inject(function() {
727
+
728
+ expectCanConnect('OtherParticipant', 'StartEvent_Message', {
729
+ sequenceFlow: false,
730
+ messageFlow: true,
731
+ association: false,
732
+ dataAssociation: false
733
+ });
734
+
735
+ }));
736
+
737
+
738
+ it('connect EndEvent_None -> OtherParticipant', inject(function() {
739
+
740
+ expectCanConnect('EndEvent_None', 'OtherParticipant', {
741
+ sequenceFlow: false,
742
+ messageFlow: true,
743
+ association: false,
744
+ dataAssociation: false
745
+ });
746
+ }));
747
+
748
+
749
+ it('connect EndEvent_Cancel -> OtherParticipant', inject(function() {
750
+
751
+ expectCanConnect('EndEvent_Cancel', 'OtherParticipant', {
752
+ sequenceFlow: false,
753
+ messageFlow: false,
754
+ association: false,
755
+ dataAssociation: false
756
+ });
757
+ }));
758
+
759
+
760
+ it('connect EndEvent_Message -> OtherParticipant', inject(function() {
761
+
762
+ expectCanConnect('EndEvent_Message', 'OtherParticipant', {
763
+ sequenceFlow: false,
764
+ messageFlow: true,
765
+ association: false,
766
+ dataAssociation: false
767
+ });
768
+ }));
769
+
770
+
771
+ it('connect OtherParticipant -> EndEvent_None', inject(function() {
772
+
773
+ expectCanConnect('OtherParticipant', 'EndEvent_None', {
774
+ sequenceFlow: false,
775
+ messageFlow: false,
776
+ association: false,
777
+ dataAssociation: false
778
+ });
779
+ }));
780
+
781
+
782
+ it('connect IntermediateThrowEvent_Message -> OtherParticipant', inject(function() {
783
+
784
+ expectCanConnect('IntermediateThrowEvent_Message', 'OtherParticipant', {
785
+ sequenceFlow: false,
786
+ messageFlow: true,
787
+ association: false,
788
+ dataAssociation: false
789
+ });
790
+ }));
791
+
792
+
793
+ it('connect IntermediateThrowEvent_None -> OtherParticipant', inject(function() {
794
+
795
+ expectCanConnect('IntermediateThrowEvent_None', 'OtherParticipant', {
796
+ sequenceFlow: false,
797
+ messageFlow: true,
798
+ association: false,
799
+ dataAssociation: false
800
+ });
801
+ }));
802
+
803
+
804
+ it('connect IntermediateThrowEvent_Signal -> OtherParticipant', inject(function() {
805
+
806
+ expectCanConnect('IntermediateThrowEvent_Signal', 'OtherParticipant', {
807
+ sequenceFlow: false,
808
+ messageFlow: false,
809
+ association: false,
810
+ dataAssociation: false
811
+ });
812
+ }));
813
+
814
+
815
+ it('connect OtherParticipant -> IntermediateThrowEvent_Message', inject(function() {
816
+
817
+ expectCanConnect('OtherParticipant', 'IntermediateThrowEvent_Message', {
818
+ sequenceFlow: false,
819
+ messageFlow: false,
820
+ association: false,
821
+ dataAssociation: false
822
+ });
823
+ }));
824
+
825
+
826
+ it('connect Task_in_SubProcess -> OtherParticipant', inject(function() {
827
+
828
+ expectCanConnect('Task_in_SubProcess', 'OtherParticipant', {
829
+ sequenceFlow: false,
830
+ messageFlow: true,
831
+ association: false,
832
+ dataAssociation: false
833
+ });
834
+ }));
835
+
836
+
837
+ it('connect EndEvent_None_in_SubProcess -> OtherParticipant', inject(function() {
838
+
839
+ expectCanConnect('EndEvent_None_in_SubProcess', 'OtherParticipant', {
840
+ sequenceFlow: false,
841
+ messageFlow: true,
842
+ association: false,
843
+ dataAssociation: false
844
+ });
845
+ }));
846
+
847
+
848
+ it('connect OtherParticipant -> Task_in_SubProcess', inject(function() {
849
+
850
+ expectCanConnect('OtherParticipant', 'Task_in_SubProcess', {
851
+ sequenceFlow: false,
852
+ messageFlow: true,
853
+ association: false,
854
+ dataAssociation: false
855
+ });
856
+ }));
857
+
858
+
859
+ it('connect Participant -> OtherParticipant', inject(function() {
860
+
861
+ expectCanConnect('Participant', 'OtherParticipant', {
862
+ sequenceFlow: false,
863
+ messageFlow: true,
864
+ association: false,
865
+ dataAssociation: false
866
+ });
867
+ }));
868
+
869
+
870
+ it('connect StartEvent_None -> TextAnnotation_OtherParticipant', inject(function() {
871
+
872
+ expectCanConnect('StartEvent_None', 'TextAnnotation_OtherParticipant', {
873
+ sequenceFlow: false,
874
+ messageFlow: false,
875
+ association: true,
876
+ dataAssociation: false
877
+ });
878
+ }));
879
+
880
+
881
+ it('drop TextAnnotation_Global -> Participant', inject(function() {
882
+
883
+ expectCanDrop('TextAnnotation_Global', 'Participant', true);
884
+ }));
885
+
886
+ it('drop element -> collapsed Participant', inject(function(canvas) {
887
+ expectCanDrop('StartEvent_None', 'CollapsedParticipant', false);
888
+ expectCanDrop('SubProcess', 'CollapsedParticipant', false);
889
+ expectCanDrop('Task_in_SubProcess', 'CollapsedParticipant', false);
890
+ expectCanDrop('TextAnnotation_Global', 'CollapsedParticipant', false);
891
+ }));
892
+
893
+ });
894
+
895
+
896
+ describe('message flows', function() {
897
+
898
+ var testXML = require('./BpmnRules.messageFlow.bpmn');
899
+
900
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
901
+
902
+
903
+ it('drop MessageFlow -> Collaboration', inject(function() {
904
+
905
+ expectCanDrop('MessageFlow', 'Collaboration', true);
906
+ }));
907
+
908
+ });
909
+
910
+
911
+ describe('data association move', function() {
912
+
913
+ describe('on process diagram', function() {
914
+
915
+ var testXML = require('./BpmnRules.dataAssociation.bpmn');
916
+
917
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
918
+
919
+
920
+ it('move selection including data association', inject(function(elementRegistry) {
921
+
922
+ // when
923
+ var elements = [
924
+ elementRegistry.get('Task'),
925
+ elementRegistry.get('DataAssociation'),
926
+ elementRegistry.get('DataObjectReference')
927
+ ];
928
+
929
+ // then
930
+ expectCanMove(elements, 'Process', {
931
+ attach: false,
932
+ move: true
933
+ });
934
+ }));
935
+
936
+ });
937
+
938
+
939
+ describe('on sub process', function() {
940
+
941
+ var testXML = require('./BpmnRules.subProcess-dataAssociation.bpmn');
942
+
943
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
944
+
945
+
946
+ it('move task and data association', inject(function(elementRegistry) {
947
+
948
+ // when
949
+ var elements = [
950
+ elementRegistry.get('DataInputAssociation'),
951
+ elementRegistry.get('DataOutputAssociation'),
952
+ elementRegistry.get('DataStoreReference'),
953
+ elementRegistry.get('Task')
954
+ ];
955
+
956
+ // then
957
+ expectCanMove(elements, 'SubProcess', {
958
+ attach: false,
959
+ move: true
960
+ });
961
+ }));
962
+ });
963
+
964
+
965
+ describe('on collaboration', function() {
966
+
967
+ var testXML = require('./BpmnRules.collaboration-dataAssociation.bpmn');
968
+
969
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
970
+
971
+
972
+ it('move participant and data association', inject(function(elementRegistry) {
973
+
974
+ // when
975
+ var elements = [
976
+ elementRegistry.get('DataInputAssociation'),
977
+ elementRegistry.get('Participant')
978
+ ];
979
+
980
+ // then
981
+ expectCanMove(elements, 'Collaboration', {
982
+ attach: false,
983
+ move: true
984
+ });
985
+ }));
986
+ });
987
+
988
+ });
989
+
990
+
991
+ describe('multi selection move', function() {
992
+
993
+ var testXML = require('./BpmnRules.multiSelectionPools.bpmn');
994
+
995
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
996
+
997
+ it('is allowed across pools when parent does not change', inject(function(elementRegistry) {
998
+
999
+ // when
1000
+ var elements = [
1001
+ elementRegistry.get('Task_A'),
1002
+ elementRegistry.get('Task_B'),
1003
+ elementRegistry.get('MessageFlow_1v3u2fb')
1004
+ ];
1005
+
1006
+ var target = 'Participant_1';
1007
+
1008
+ // then
1009
+ expectCanMove(elements, target, {
1010
+ attach: false,
1011
+ move: true
1012
+ });
1013
+ }));
1014
+ });
1015
+
1016
+ describe('event move', function() {
1017
+
1018
+ var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
1019
+
1020
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1021
+
1022
+
1023
+ it('attach/move BoundaryEvent -> Process', inject(function(elementRegistry) {
1024
+
1025
+ // when
1026
+ var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
1027
+
1028
+ var elements = [ boundaryEvent ];
1029
+
1030
+ // then
1031
+ expectCanMove(elements, 'Process_1', {
1032
+ attach: false,
1033
+ move: false
1034
+ });
1035
+
1036
+ }));
1037
+
1038
+
1039
+ it('attach/move BoundaryEvent -> Task', inject(function(elementRegistry) {
1040
+
1041
+ // when
1042
+ var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
1043
+
1044
+ var elements = [ boundaryEvent ];
1045
+
1046
+ // then
1047
+ expectCanMove(elements, 'Task_2', {
1048
+ attach: 'attach',
1049
+ move: false
1050
+ });
1051
+
1052
+ }));
1053
+
1054
+
1055
+ it('attach/move BoundaryEvent label -> SubProcess', inject(function(elementRegistry) {
1056
+
1057
+ // when
1058
+ var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1059
+ label = boundaryEvent.label;
1060
+
1061
+ var elements = [ label ];
1062
+
1063
+ // then
1064
+ expectCanMove(elements, 'SubProcess_1', {
1065
+ attach: false,
1066
+ move: true
1067
+ });
1068
+
1069
+ }));
1070
+
1071
+
1072
+ it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function(elementRegistry) {
1073
+ // when
1074
+ var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1075
+ boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
1076
+
1077
+ // we assume boundary events and labels
1078
+ // to be already filtered during move
1079
+ var elements = [ boundaryEvent, boundaryEvent2 ];
1080
+
1081
+ // then
1082
+ expectCanMove(elements, 'SubProcess_1', {
1083
+ attach: false,
1084
+ move: false
1085
+ });
1086
+ }));
1087
+
1088
+
1089
+ it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function(elementRegistry) {
1090
+ // when
1091
+ var subProcess = elementRegistry.get('SubProcess_1'),
1092
+ boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
1093
+ label = boundaryEvent.label;
1094
+
1095
+ // we assume boundary events and labels
1096
+ // to be already filtered during move
1097
+ var elements = [ subProcess, boundaryEvent, label ];
1098
+
1099
+ // then
1100
+ expectCanMove(elements, 'Process_1', {
1101
+ attach: false,
1102
+ move: false
1103
+ });
1104
+ }));
1105
+
1106
+ });
1107
+
1108
+
1109
+ describe('event create', function() {
1110
+
1111
+ var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
1112
+
1113
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1114
+
1115
+
1116
+ it('attach IntermediateEvent to Task', inject(function(elementFactory) {
1117
+
1118
+ // given
1119
+ var eventShape = elementFactory.createShape({
1120
+ type: 'bpmn:IntermediateThrowEvent',
1121
+ x: 413, y: 254
1122
+ });
1123
+
1124
+ // then
1125
+ expectCanMove([ eventShape ], 'Task_1', {
1126
+ attach: 'attach',
1127
+ move: false
1128
+ });
1129
+ }));
1130
+
1131
+
1132
+ it('not attach IntermediateEvent to CompensationTask', inject(function(elementFactory) {
1133
+
1134
+ // given
1135
+ var eventShape = elementFactory.createShape({
1136
+ type: 'bpmn:IntermediateThrowEvent',
1137
+ x: 413, y: 254
1138
+ });
1139
+
1140
+ // then
1141
+ expectCanMove([ eventShape ], 'CompensationTask', {
1142
+ attach: false,
1143
+ move: false
1144
+ });
1145
+ }));
1146
+
1147
+
1148
+ it('attach IntermediateEvent to SubProcess inner', inject(function(elementFactory, elementRegistry, bpmnRules) {
1149
+
1150
+ // given
1151
+ var subProcessElement = elementRegistry.get('SubProcess_1');
1152
+ var eventShape = elementFactory.createShape({
1153
+ type: 'bpmn:IntermediateThrowEvent',
1154
+ x: 413, y: 350
1155
+ });
1156
+
1157
+ var position = {
1158
+ x: subProcessElement.x + subProcessElement.width / 2,
1159
+ y: subProcessElement.y + subProcessElement.height / 2
1160
+ };
1161
+
1162
+ // when
1163
+ var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
1164
+
1165
+ // then
1166
+ expect(canAttach).to.be.false;
1167
+ }));
1168
+
1169
+
1170
+ it('attach IntermediateEvent to SubProcess border', inject(function(elementFactory, elementRegistry, bpmnRules) {
1171
+
1172
+ // given
1173
+ var subProcessElement = elementRegistry.get('SubProcess_1');
1174
+ var eventShape = elementFactory.createShape({
1175
+ type: 'bpmn:IntermediateThrowEvent',
1176
+ x: 0, y: 0
1177
+ });
1178
+
1179
+ var position = {
1180
+ x: subProcessElement.x + subProcessElement.width / 2,
1181
+ y: subProcessElement.y + subProcessElement.height
1182
+ };
1183
+
1184
+ // when
1185
+ var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
1186
+
1187
+ // then
1188
+ expect(canAttach).to.equal('attach');
1189
+ }));
1190
+
1191
+
1192
+ it('not attach IntermediateEvent to compensation activity', inject(function(elementFactory, elementRegistry, bpmnRules) {
1193
+
1194
+ // given
1195
+ var compensationTask = elementRegistry.get('CompensationTask');
1196
+ var eventShape = elementFactory.createShape({
1197
+ type: 'bpmn:IntermediateThrowEvent',
1198
+ x: 0, y: 0
1199
+ });
1200
+
1201
+ var position = {
1202
+ x: compensationTask.x + compensationTask.width / 2,
1203
+ y: compensationTask.y + compensationTask.height
1204
+ };
1205
+
1206
+ // when
1207
+ var canAttach = bpmnRules.canAttach([ eventShape ], compensationTask, null, position);
1208
+
1209
+ // then
1210
+ expect(canAttach).to.be.false;
1211
+ }));
1212
+
1213
+
1214
+ it('create IntermediateEvent in SubProcess body', inject(function(elementFactory, elementRegistry, bpmnRules) {
1215
+
1216
+ // given
1217
+ var subProcessElement = elementRegistry.get('SubProcess_1');
1218
+ var eventShape = elementFactory.createShape({
1219
+ type: 'bpmn:IntermediateThrowEvent',
1220
+ x: 413, y: 250
1221
+ });
1222
+
1223
+ var position = {
1224
+ x: eventShape.x,
1225
+ y: eventShape.y
1226
+ };
1227
+
1228
+ // when
1229
+ var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position),
1230
+ canCreate = bpmnRules.canCreate(eventShape, subProcessElement, null, position);
1231
+
1232
+ // then
1233
+ expect(canAttach).to.be.false;
1234
+ expect(canCreate).to.be.true;
1235
+ }));
1236
+
1237
+ });
1238
+
1239
+
1240
+ describe('event append', function() {
1241
+
1242
+ var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
1243
+
1244
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1245
+
1246
+
1247
+ it('append IntermediateEvent from Task', inject(function(elementFactory, elementRegistry, bpmnRules) {
1248
+
1249
+ // given
1250
+ var subProcessElement = elementRegistry.get('SubProcess_1'),
1251
+ taskElement = elementRegistry.get('Task_2');
1252
+
1253
+ var eventShape = elementFactory.createShape({
1254
+ type: 'bpmn:IntermediateThrowEvent',
1255
+ x: 413, y: 250
1256
+ });
1257
+
1258
+ var position = {
1259
+ x: eventShape.x,
1260
+ y: eventShape.y
1261
+ };
1262
+
1263
+ // when
1264
+ var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, taskElement, position),
1265
+ canCreate = bpmnRules.canCreate(eventShape, subProcessElement, taskElement, position);
1266
+
1267
+ // then
1268
+ expect(canAttach).to.be.false;
1269
+ expect(canCreate).to.be.true;
1270
+ }));
1271
+
1272
+
1273
+ it('append IntermediateEvent from BoundaryEvent', inject(function(elementFactory, elementRegistry, bpmnRules) {
1274
+
1275
+ // given
1276
+ var boundaryElement = elementRegistry.get('BoundaryEvent_1'),
1277
+ taskElement = elementRegistry.get('Task_2');
1278
+
1279
+ var eventShape = elementFactory.createShape({
1280
+ type: 'bpmn:IntermediateThrowEvent',
1281
+ x: 413, y: 250
1282
+ });
1283
+
1284
+ // when
1285
+ var canAttach = bpmnRules.canAttach([ eventShape ], taskElement, boundaryElement),
1286
+ canCreate = bpmnRules.canCreate(eventShape, taskElement, boundaryElement);
1287
+
1288
+ // then
1289
+ expect(canAttach).to.be.false;
1290
+ expect(canCreate).to.be.false;
1291
+ }));
1292
+
1293
+ });
1294
+
1295
+
1296
+ describe('lanes', function() {
1297
+
1298
+ var testXML = require('./BpmnRules.collaboration-lanes.bpmn');
1299
+
1300
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1301
+
1302
+
1303
+ describe('should add', function() {
1304
+
1305
+ it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
1306
+
1307
+ // given
1308
+ var participantElement = elementRegistry.get('Participant');
1309
+
1310
+ var laneShape = elementFactory.createShape({
1311
+ type: 'bpmn:Lane',
1312
+ x: 413, y: 250
1313
+ });
1314
+
1315
+ // when
1316
+ var canCreate = bpmnRules.canCreate(laneShape, participantElement);
1317
+
1318
+ // then
1319
+ expect(canCreate).to.be.true;
1320
+ }));
1321
+
1322
+
1323
+ it('Lane -> Participant_Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1324
+
1325
+ // given
1326
+ var participantElement = elementRegistry.get('Participant_Lane');
1327
+
1328
+ var laneShape = elementFactory.createShape({
1329
+ type: 'bpmn:Lane',
1330
+ x: 413, y: 250
1331
+ });
1332
+
1333
+ // when
1334
+ var canCreate = bpmnRules.canCreate(laneShape, participantElement);
1335
+
1336
+ // then
1337
+ expect(canCreate).to.be.true;
1338
+ }));
1339
+
1340
+
1341
+ it('[not] Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
1342
+
1343
+ // given
1344
+ var subProcessElement = elementRegistry.get('SubProcess');
1345
+
1346
+ var laneShape = elementFactory.createShape({
1347
+ type: 'bpmn:Lane',
1348
+ x: 413, y: 250
1349
+ });
1350
+
1351
+ // when
1352
+ var canCreate = bpmnRules.canCreate(laneShape, subProcessElement);
1353
+
1354
+ // then
1355
+ expect(canCreate).to.be.false;
1356
+ }));
1357
+
1358
+ });
1359
+
1360
+
1361
+ describe('should not allow move', function() {
1362
+
1363
+ it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
1364
+
1365
+ // given
1366
+ var participantElement = elementRegistry.get('Participant'),
1367
+ laneElement = elementRegistry.get('Lane');
1368
+
1369
+ // when
1370
+ var canMove = bpmnRules.canMove([ laneElement ], participantElement);
1371
+
1372
+ // then
1373
+ expect(canMove).to.be.false;
1374
+ }));
1375
+
1376
+
1377
+ it('Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
1378
+
1379
+ // given
1380
+ var subProcessElement = elementRegistry.get('SubProcess'),
1381
+ laneElement = elementRegistry.get('Lane');
1382
+
1383
+ // when
1384
+ var canMove = bpmnRules.canMove([ laneElement ], subProcessElement);
1385
+
1386
+ // then
1387
+ expect(canMove).to.be.false;
1388
+ }));
1389
+
1390
+ });
1391
+
1392
+
1393
+ describe('should resize', function() {
1394
+
1395
+ it('Lane', inject(function(bpmnRules, elementRegistry) {
1396
+
1397
+ // given
1398
+ var laneElement = elementRegistry.get('Lane');
1399
+
1400
+ // when
1401
+ var canResize = bpmnRules.canResize(laneElement);
1402
+
1403
+ // then
1404
+ expect(canResize).to.be.true;
1405
+ }));
1406
+
1407
+ });
1408
+
1409
+
1410
+ describe('should allow drop', function() {
1411
+
1412
+ it('SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1413
+
1414
+ // given
1415
+ var element = elementRegistry.get('SubProcess'),
1416
+ laneElement = elementRegistry.get('Lane');
1417
+
1418
+ // when
1419
+ var canMove = bpmnRules.canMove([ element ], laneElement);
1420
+
1421
+ // then
1422
+ expect(canMove).to.be.true;
1423
+ }));
1424
+
1425
+
1426
+ it('Task_in_SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
1427
+
1428
+ // given
1429
+ var element = elementRegistry.get('Task_in_SubProcess'),
1430
+ laneElement = elementRegistry.get('Lane');
1431
+
1432
+ // when
1433
+ var canMove = bpmnRules.canMove([ element ], laneElement);
1434
+
1435
+ // then
1436
+ expect(canMove).to.be.true;
1437
+ }));
1438
+
1439
+ });
1440
+
1441
+ });
1442
+
1443
+
1444
+ describe('labels', function() {
1445
+
1446
+ var testXML = require('./BpmnRules.process.bpmn');
1447
+
1448
+ beforeEach(bootstrapModeler(testXML, { modules: testModules }));
1449
+
1450
+
1451
+ it('should filter labels', inject(function(elementRegistry, rules) {
1452
+
1453
+ // given
1454
+ var startEventShape = elementRegistry.get('StartEvent_None'),
1455
+ startEventLabel = startEventShape.label;
1456
+
1457
+ // when
1458
+ var allowed = rules.allowed('elements.delete', {
1459
+ elements: [ startEventShape, startEventLabel ]
1460
+ });
1461
+
1462
+ // then
1463
+ expect(allowed).to.eql([ startEventShape ]);
1464
+ }));
1465
+
1466
+ });
1467
+
1468
+ });