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.
- package/.eslintrc +33 -33
- package/.npmignore +8 -8
- package/.travis.yml +19 -17
- package/.wiredeps +88 -88
- package/CONTRIBUTING.md +55 -55
- package/Gruntfile.js +129 -129
- package/LICENSE +22 -22
- package/README.md +113 -113
- package/assets/bpmn-font/css/bpmn-embedded.css +159 -159
- package/assets/bpmn-font/css/bpmn.css +161 -161
- package/assets/bpmn-font/font/bpmn.svg +116 -116
- package/docs/architecture/overview.svg +48 -48
- package/docs/project/COMMIT_MESSAGES.md +82 -82
- package/docs/project/SETUP.md +66 -66
- package/docs/project/setup-alternative.sh +41 -41
- package/docs/project/setup.bat +45 -45
- package/docs/project/setup.sh +40 -40
- package/docs/translations.json +97 -97
- package/lib/Modeler.js +208 -208
- package/lib/NavigatedViewer.js +27 -27
- package/lib/Viewer.js +503 -503
- package/lib/core/index.js +5 -5
- package/lib/draw/BpmnRenderer.js +1934 -1934
- package/lib/draw/PathMap.js +478 -478
- package/lib/draw/index.js +5 -5
- package/lib/features/auto-resize/BpmnAutoResize.js +34 -34
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +51 -51
- package/lib/features/auto-resize/index.js +5 -5
- package/lib/features/context-pad/ContextPadProvider.js +374 -374
- package/lib/features/context-pad/index.js +11 -11
- package/lib/features/copy-paste/BpmnCopyPaste.js +157 -154
- package/lib/features/copy-paste/index.js +7 -7
- package/lib/features/distribute-elements/BpmnDistributeElements.js +34 -34
- package/lib/features/distribute-elements/index.js +7 -7
- package/lib/features/editor-actions/BpmnEditorActions.js +130 -130
- package/lib/features/editor-actions/index.js +15 -15
- package/lib/features/global-connect/BpmnGlobalConnect.js +49 -49
- package/lib/features/global-connect/index.js +7 -7
- package/lib/features/keyboard/BpmnKeyBindings.js +72 -72
- package/lib/features/keyboard/index.js +7 -7
- package/lib/features/label-editing/LabelEditingPreview.js +122 -0
- package/lib/features/label-editing/LabelEditingProvider.js +292 -193
- package/lib/features/label-editing/LabelUtil.js +43 -43
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +116 -112
- package/lib/features/label-editing/index.js +14 -9
- package/lib/features/modeling/BpmnFactory.js +97 -97
- package/lib/features/modeling/BpmnLayouter.js +191 -191
- package/lib/features/modeling/BpmnUpdater.js +692 -688
- package/lib/features/modeling/ElementFactory.js +218 -218
- package/lib/features/modeling/Modeling.js +183 -183
- package/lib/features/modeling/behavior/AppendBehavior.js +42 -42
- package/lib/features/modeling/behavior/CopyPasteBehavior.js +69 -69
- package/lib/features/modeling/behavior/CreateBoundaryEventBehavior.js +51 -51
- package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +37 -37
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +91 -91
- package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +151 -151
- package/lib/features/modeling/behavior/DeleteLaneBehavior.js +107 -107
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +165 -131
- package/lib/features/modeling/behavior/ImportDockingFix.js +80 -80
- package/lib/features/modeling/behavior/LabelBehavior.js +222 -222
- package/lib/features/modeling/behavior/ModelingFeedback.js +50 -50
- package/lib/features/modeling/behavior/RemoveElementBehavior.js +73 -73
- package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +50 -50
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +128 -128
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +118 -116
- package/lib/features/modeling/behavior/ResizeLaneBehavior.js +59 -59
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +138 -138
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +27 -27
- package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +54 -54
- package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +156 -156
- package/lib/features/modeling/behavior/index.js +44 -44
- package/lib/features/modeling/behavior/util/GeometricUtil.js +129 -129
- package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +218 -218
- package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +233 -233
- package/lib/features/modeling/behavior/util/LineIntersect.js +36 -36
- package/lib/features/modeling/cmd/AddLaneHandler.js +83 -83
- package/lib/features/modeling/cmd/IdClaimHandler.js +41 -41
- package/lib/features/modeling/cmd/ResizeLaneHandler.js +125 -125
- package/lib/features/modeling/cmd/SplitLaneHandler.js +82 -82
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +78 -78
- package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +185 -185
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +264 -264
- package/lib/features/modeling/index.js +23 -23
- package/lib/features/modeling/util/LaneUtil.js +157 -157
- package/lib/features/modeling/util/ModelingUtil.js +48 -48
- package/lib/features/ordering/BpmnOrderingProvider.js +147 -147
- package/lib/features/ordering/index.js +6 -6
- package/lib/features/palette/PaletteProvider.js +158 -158
- package/lib/features/palette/index.js +13 -13
- package/lib/features/popup-menu/ReplaceMenuProvider.js +479 -479
- package/lib/features/popup-menu/index.js +7 -7
- package/lib/features/popup-menu/util/TypeUtil.js +41 -41
- package/lib/features/replace/BpmnReplace.js +197 -197
- package/lib/features/replace/ReplaceOptions.js +787 -787
- package/lib/features/replace/index.js +7 -7
- package/lib/features/replace-preview/BpmnReplacePreview.js +113 -113
- package/lib/features/replace-preview/index.js +5 -5
- package/lib/features/rules/BpmnRules.js +807 -806
- package/lib/features/rules/index.js +7 -7
- package/lib/features/search/BpmnSearchProvider.js +128 -128
- package/lib/features/search/index.js +7 -7
- package/lib/features/snapping/BpmnSnapping.js +511 -495
- package/lib/features/snapping/BpmnSnappingUtil.js +159 -159
- package/lib/features/snapping/index.js +3 -3
- package/lib/import/BpmnImporter.js +302 -302
- package/lib/import/BpmnTreeWalker.js +445 -445
- package/lib/import/Importer.js +69 -69
- package/lib/import/Util.js +8 -8
- package/lib/import/index.js +5 -5
- package/lib/util/DiUtil.js +60 -60
- package/lib/util/LabelUtil.js +139 -139
- package/lib/util/ModelUtil.js +31 -31
- package/lib/util/PoweredByUtil.js +82 -82
- package/lib/util/model/ModelCloneHelper.js +201 -201
- package/lib/util/model/ModelCloneUtils.js +35 -35
- package/package.json +22 -22
- package/resources/initial.bpmn +12 -12
- package/resources/screencast.gif +0 -0
- package/tasks/banner.txt +11 -11
- package/tasks/bundle.js +162 -162
- package/test/TestHelper.js +17 -17
- package/test/config/karma.unit.js +46 -46
- package/test/config/translation-reporter.js +48 -48
- package/test/fixtures/bpmn/align-elements.bpmn +136 -136
- package/test/fixtures/bpmn/basic.bpmn +17 -17
- package/test/fixtures/bpmn/boundary-events.bpmn +59 -59
- package/test/fixtures/bpmn/collaboration/collaboration-empty-participant.bpmn +13 -13
- package/test/fixtures/bpmn/collaboration/collaboration-message-flows.bpmn +89 -89
- package/test/fixtures/bpmn/collaboration/collaboration-participant.bpmn +59 -59
- package/test/fixtures/bpmn/collaboration/process-empty.bpmn +6 -6
- package/test/fixtures/bpmn/collaboration/process.bpmn +47 -47
- package/test/fixtures/bpmn/collaboration-data-items.bpmn +81 -81
- package/test/fixtures/bpmn/collaboration-message-flows.bpmn +82 -82
- package/test/fixtures/bpmn/collaboration-sequence-flows.bpmn +83 -83
- package/test/fixtures/bpmn/collaboration.bpmn +50 -50
- package/test/fixtures/bpmn/complex.bpmn +2151 -2151
- package/test/fixtures/bpmn/conditions.bpmn +82 -82
- package/test/fixtures/bpmn/containers.bpmn +128 -128
- package/test/fixtures/bpmn/distribute-elements-filtering.bpmn +58 -58
- package/test/fixtures/bpmn/distribute-elements.bpmn +232 -232
- package/test/fixtures/bpmn/draw/activity-markers-combination.bpmn +141 -141
- package/test/fixtures/bpmn/draw/activity-markers-simple.bpmn +47 -47
- package/test/fixtures/bpmn/draw/activity-markers.bpmn +212 -212
- package/test/fixtures/bpmn/draw/associations.bpmn +55 -55
- package/test/fixtures/bpmn/draw/boundary-event-with-refnode.bpmn +81 -81
- package/test/fixtures/bpmn/draw/boundary-event-without-refnode.bpmn +81 -81
- package/test/fixtures/bpmn/draw/boundary-event-z-index.bpmn +82 -82
- package/test/fixtures/bpmn/draw/call-activity.bpmn +12 -12
- package/test/fixtures/bpmn/draw/colors.bpmn +411 -411
- package/test/fixtures/bpmn/draw/conditional-flow-default.bpmn +100 -100
- package/test/fixtures/bpmn/draw/conditional-flow-gateways.bpmn +72 -72
- package/test/fixtures/bpmn/draw/conditional-flow-typed-task.bpmn +33 -33
- package/test/fixtures/bpmn/draw/conditional-flow.bpmn +248 -248
- package/test/fixtures/bpmn/draw/data-objects.bpmn +265 -265
- package/test/fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn +200 -200
- package/test/fixtures/bpmn/draw/event-subprocesses-expanded.bpmn +274 -274
- package/test/fixtures/bpmn/draw/events-interrupting.bpmn +370 -370
- package/test/fixtures/bpmn/draw/events.bpmn +374 -374
- package/test/fixtures/bpmn/draw/gateway-type-default.bpmn +45 -45
- package/test/fixtures/bpmn/draw/gateways.bpmn +61 -61
- package/test/fixtures/bpmn/draw/group.bpmn +24 -24
- package/test/fixtures/bpmn/draw/message-marker.bpmn +112 -112
- package/test/fixtures/bpmn/draw/pools-with-collection-marker.bpmn +104 -104
- package/test/fixtures/bpmn/draw/pools.bpmn +82 -82
- package/test/fixtures/bpmn/draw/task-types.bpmn +77 -77
- package/test/fixtures/bpmn/draw/text-annotation.bpmn +71 -71
- package/test/fixtures/bpmn/draw/xor.bpmn +45 -45
- package/test/fixtures/bpmn/empty-definitions.bpmn +4 -4
- package/test/fixtures/bpmn/error/categoryValue.bpmn +26 -26
- package/test/fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn +9 -9
- package/test/fixtures/bpmn/error/duplicate-ids.bpmn +14 -14
- package/test/fixtures/bpmn/error/invalid-child.bpmn +6 -6
- package/test/fixtures/bpmn/error/missing-namespace.bpmn +12 -12
- package/test/fixtures/bpmn/event-sub-processes.bpmn +47 -47
- package/test/fixtures/bpmn/extension/camunda.bpmn +52 -52
- package/test/fixtures/bpmn/extension/custom-override.bpmn +53 -53
- package/test/fixtures/bpmn/extension/custom.bpmn +53 -53
- package/test/fixtures/bpmn/features/copy-paste/basic.bpmn +111 -111
- package/test/fixtures/bpmn/features/copy-paste/collaboration-multiple.bpmn +102 -102
- package/test/fixtures/bpmn/features/copy-paste/collaboration.bpmn +74 -74
- package/test/fixtures/bpmn/features/copy-paste/data-associations.bpmn +61 -61
- package/test/fixtures/bpmn/features/copy-paste/properties.bpmn +43 -43
- package/test/fixtures/bpmn/features/drop/drop.bpmn +41 -41
- package/test/fixtures/bpmn/features/drop/recursive-task.bpmn +37 -37
- package/test/fixtures/bpmn/features/label-editing/labels.bpmn +178 -248
- package/test/fixtures/bpmn/features/modeling/update-label.bpmn +24 -24
- package/test/fixtures/bpmn/features/replace/01_replace.bpmn +193 -193
- package/test/fixtures/bpmn/features/replace/association-gateways.bpmn +173 -173
- package/test/fixtures/bpmn/features/replace/cancel-events.bpmn +49 -49
- package/test/fixtures/bpmn/features/replace/clone-properties.bpmn +141 -141
- package/test/fixtures/bpmn/features/replace/connection.bpmn +42 -42
- package/test/fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn +72 -72
- package/test/fixtures/bpmn/features/rules/link-event.bpmn +35 -35
- package/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn +30 -30
- package/test/fixtures/bpmn/flow-markers.bpmn +212 -212
- package/test/fixtures/bpmn/import/boundaryEvent.bpmn +33 -33
- package/test/fixtures/bpmn/import/collaboration.bpmn +50 -50
- package/test/fixtures/bpmn/import/collapsed/collaboration.bpmn +76 -76
- package/test/fixtures/bpmn/import/collapsed/process.bpmn +84 -84
- package/test/fixtures/bpmn/import/collapsed/processWithChildren.bpmn +273 -273
- package/test/fixtures/bpmn/import/default-attrs.bpmn +24 -24
- package/test/fixtures/bpmn/import/error/boundaryEvent-invalidAttachToRef.bpmn +30 -30
- package/test/fixtures/bpmn/import/error/boundaryEvent-missingAttachToRef.bpmn +33 -33
- package/test/fixtures/bpmn/import/error/dangling-process-message-flow.bpmn +81 -81
- package/test/fixtures/bpmn/import/error/invalid-flow-element.bpmn +35 -35
- package/test/fixtures/bpmn/import/error/multiple-dis.bpmn +23 -23
- package/test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn +41 -41
- package/test/fixtures/bpmn/import/labels/collaboration.bpmn +72 -72
- package/test/fixtures/bpmn/import/labels/embedded.bpmn +39 -39
- package/test/fixtures/bpmn/import/labels/external-no-di.bpmn +42 -42
- package/test/fixtures/bpmn/import/labels/external.bpmn +69 -69
- package/test/fixtures/bpmn/import/position/position-testcase.bpmn +57 -57
- package/test/fixtures/bpmn/import/process.bpmn +60 -60
- package/test/fixtures/bpmn/nested-subprocesses.bpmn +118 -118
- package/test/fixtures/bpmn/sequence-flows.bpmn +60 -60
- package/test/fixtures/bpmn/simple-cropping.bpmn +84 -84
- package/test/fixtures/bpmn/simple-resizable.bpmn +50 -50
- package/test/fixtures/bpmn/simple.bpmn +60 -60
- package/test/fixtures/json/model/camunda.json +1042 -1042
- package/test/fixtures/json/model/custom-override.json +39 -39
- package/test/fixtures/json/model/custom.json +39 -39
- package/test/helper/TranslationCollector.js +17 -17
- package/test/helper/index.js +249 -249
- package/test/integration/CustomElementsSpec.js +223 -223
- package/test/integration/ReimportSpec.js +89 -89
- package/test/integration/SimpleModelingSpec.js +29 -29
- package/test/integration/custom-elements/CustomElementFactory.js +77 -77
- package/test/integration/custom-elements/CustomRenderer.js +151 -151
- package/test/integration/custom-elements/CustomRules.js +148 -148
- package/test/integration/custom-elements/CustomUpdater.js +115 -115
- package/test/integration/custom-elements/index.js +7 -7
- package/test/integration/model/BpmnModdleSpec.js +65 -65
- package/test/matchers/JSONMatcher.js +19 -19
- package/test/spec/ModelerSpec.js +401 -401
- package/test/spec/NavigatedViewerSpec.js +58 -58
- package/test/spec/ViewerSpec.js +977 -977
- package/test/spec/draw/BpmnRendererSpec.js +311 -311
- package/test/spec/environment/MockingSpec.js +53 -53
- package/test/spec/features/align-elements/BpmnAlignElementsSpec.js +137 -137
- package/test/spec/features/auto-resize/AutoResize.lanes.bpmn +54 -54
- package/test/spec/features/auto-resize/AutoResize.multi-selection.bpmn +22 -22
- package/test/spec/features/auto-resize/AutoResize.nested-sub-processes.bpmn +47 -47
- package/test/spec/features/auto-resize/AutoResize.participant.bpmn +38 -38
- package/test/spec/features/auto-resize/AutoResize.space-tool.bpmn +38 -38
- package/test/spec/features/auto-resize/AutoResize.sub-processes.bpmn +37 -37
- package/test/spec/features/auto-resize/AutoResizeSpec.js +607 -607
- package/test/spec/features/context-pad/ContextPad.activation.bpmn +51 -51
- package/test/spec/features/context-pad/ContextPadProviderSpec.js +440 -440
- package/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +763 -725
- package/test/spec/features/copy-paste/DescriptorTree.js +58 -58
- package/test/spec/features/distribute-elements/BpmnDistributeElementsSpec.js +113 -113
- package/test/spec/features/editor-actions/BpmnEditorActionsSpec.js +72 -72
- package/test/spec/features/global-connect/BpmnGlobalConnectSpec.js +61 -61
- package/test/spec/features/keyboard/BpmnKeyBindingsSpec.js +142 -142
- package/test/spec/features/label-editing/LabelEditingPreviewSpec.js +133 -0
- package/test/spec/features/label-editing/LabelEditingProviderSpec.js +636 -601
- package/test/spec/features/label-editing/TouchIntegrationSpec.js +40 -40
- package/test/spec/features/modeling/AppendShapeSpec.js +332 -332
- package/test/spec/features/modeling/BendpointsSpec.js +25 -25
- package/test/spec/features/modeling/BpmnFactorySpec.js +73 -73
- package/test/spec/features/modeling/BpmnUpdater.bpmn +99 -99
- package/test/spec/features/modeling/BpmnUpdaterSpec.js +79 -79
- package/test/spec/features/modeling/CreateConnectionSpec.js +171 -171
- package/test/spec/features/modeling/DeleteConnectionSpec.js +75 -75
- package/test/spec/features/modeling/DeleteParticipantSpec.js +97 -97
- package/test/spec/features/modeling/DeleteShapeSpec.js +75 -75
- package/test/spec/features/modeling/DropSpec.js +123 -123
- package/test/spec/features/modeling/IdClaim.bpmn +13 -13
- package/test/spec/features/modeling/IdClaimSpec.js +50 -50
- package/test/spec/features/modeling/LabelBoundsSpec.js +342 -340
- package/test/spec/features/modeling/LabelBoundsSpec.simple.bpmn +27 -27
- package/test/spec/features/modeling/LabelLayouting.initial.bpmn +37 -37
- package/test/spec/features/modeling/LabelLayouting.move.bpmn +99 -99
- package/test/spec/features/modeling/LabelLayouting.special.bpmn +76 -76
- package/test/spec/features/modeling/LabelLayoutingSpec.js +603 -603
- package/test/spec/features/modeling/MoveConnectionSpec.js +101 -101
- package/test/spec/features/modeling/MoveElements.flow-collaboration.bpmn +45 -45
- package/test/spec/features/modeling/MoveElementsSpec.js +70 -70
- package/test/spec/features/modeling/MoveRulesSpec.js +151 -151
- package/test/spec/features/modeling/MoveShapeSpec.js +353 -353
- package/test/spec/features/modeling/ResizeShapeSpec.js +73 -73
- package/test/spec/features/modeling/SpaceToolSpec.js +251 -251
- package/test/spec/features/modeling/UpdateAttachmentSpec.js +96 -96
- package/test/spec/features/modeling/UpdateLabelSpec.js +130 -130
- package/test/spec/features/modeling/UpdatePropertiesSpec.js +503 -503
- package/test/spec/features/modeling/append/TextAnnotationSpec.js +136 -136
- package/test/spec/features/modeling/behavior/CompensationAssociationBehavior.bpmn +26 -26
- package/test/spec/features/modeling/behavior/CompensationAssociationBehaviorSpec.js +43 -43
- package/test/spec/features/modeling/behavior/CreateBoundaryEventBehaviorSpec.js +58 -58
- package/test/spec/features/modeling/behavior/CreateParticipantBehaviorSpec.js +224 -224
- package/test/spec/features/modeling/behavior/DataInputAssociationBehavior.bpmn +33 -33
- package/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js +146 -146
- package/test/spec/features/modeling/behavior/DataObjectBehavior.create-data-association.bpmn +21 -21
- package/test/spec/features/modeling/behavior/DataObjectBehavior.data-object-reference.bpmn +13 -13
- package/test/spec/features/modeling/behavior/DataObjectBehavior.remove-data-association.bpmn +41 -41
- package/test/spec/features/modeling/behavior/DataObjectBehaviorSpec.js +297 -297
- package/test/spec/features/modeling/behavior/DataStoreBehavior.bpmn +26 -26
- package/test/spec/features/modeling/behavior/DataStoreBehavior.connect.bpmn +57 -57
- package/test/spec/features/modeling/behavior/DataStoreBehaviorSpec.js +228 -228
- package/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn +71 -67
- package/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +591 -418
- package/test/spec/features/modeling/behavior/ImportDockingFix.bpmn +61 -61
- package/test/spec/features/modeling/behavior/ImportDockingFixSpec.js +37 -37
- package/test/spec/features/modeling/behavior/LabelBehaviorSpec.js +277 -277
- package/test/spec/features/modeling/behavior/ReconnectConnection.data-association.bpmn +41 -41
- package/test/spec/features/modeling/behavior/ReconnectConnectionSpec.js +120 -120
- package/test/spec/features/modeling/behavior/RemoveElementBehavior.bpmn +181 -181
- package/test/spec/features/modeling/behavior/RemoveElementBehavior.perpendicular.bpmn +159 -159
- package/test/spec/features/modeling/behavior/RemoveElementBehaviorSpec.js +251 -251
- package/test/spec/features/modeling/behavior/RemoveParticipantBehaviorSpec.js +125 -125
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.association.bpmn +26 -26
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.boundary-events.bpmn +40 -40
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.message-sequence-flow.bpmn +121 -121
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js +439 -439
- package/test/spec/features/modeling/behavior/ReplaceElementBehaviourSpec.js +450 -450
- package/test/spec/features/modeling/behavior/ToggleElementCollapseBehaviourSpec.js +653 -653
- package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.bpmn +48 -48
- package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.js +77 -77
- package/test/spec/features/modeling/behavior/util/GeometricUtilSpec.js +127 -127
- package/test/spec/features/modeling/behavior/util/LabelLayoutUtilSpec.js +75 -75
- package/test/spec/features/modeling/behavior/util/LineAttachmentUtilSpec.js +294 -294
- package/test/spec/features/modeling/behavior/util/LineIntersectSpec.js +32 -32
- package/test/spec/features/modeling/lanes/AddLaneSpec.js +263 -263
- package/test/spec/features/modeling/lanes/DeleteLaneSpec.js +126 -126
- package/test/spec/features/modeling/lanes/ResizeLaneSpec.js +366 -366
- package/test/spec/features/modeling/lanes/SplitLaneSpec.js +216 -216
- package/test/spec/features/modeling/lanes/UpdateFlowNodeRefsSpec.js +271 -271
- package/test/spec/features/modeling/lanes/flowNodeRefs.bpmn +56 -56
- package/test/spec/features/modeling/lanes/lanes.bpmn +83 -83
- package/test/spec/features/modeling/lanes/participant-lane.bpmn +27 -27
- package/test/spec/features/modeling/lanes/participant-no-lane.bpmn +22 -22
- package/test/spec/features/modeling/layout/Helper.js +64 -64
- package/test/spec/features/modeling/layout/LayoutAssociationSpec.js +101 -101
- package/test/spec/features/modeling/layout/LayoutConnectionSpec.js +98 -98
- package/test/spec/features/modeling/layout/LayoutDataAssociationSpec.js +98 -98
- package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.bpmn +119 -119
- package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.js +313 -313
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.boundaryEvents.bpmn +65 -65
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.flowElements.bpmn +70 -70
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js +323 -323
- package/test/spec/features/ordering/BpmnOrderingProviderSpec.js +231 -231
- package/test/spec/features/ordering/Helper.js +185 -185
- package/test/spec/features/ordering/ordering-start-event.bpmn +17 -17
- package/test/spec/features/ordering/ordering-subprocesses.bpmn +41 -41
- package/test/spec/features/ordering/ordering.bpmn +105 -105
- package/test/spec/features/palette/PaletteProviderSpec.js +33 -33
- package/test/spec/features/popup-menu/ReplaceMenuProvider.collapsedSubProcess.bpmn +13 -13
- package/test/spec/features/popup-menu/ReplaceMenuProvider.compensation-activity.bpmn +12 -12
- package/test/spec/features/popup-menu/ReplaceMenuProvider.conditionalFlows.bpmn +66 -66
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlows.bpmn +126 -126
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn +48 -48
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn +48 -48
- package/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +1957 -1957
- package/test/spec/features/replace/BpmnReplace.collaboration.bpmn +70 -70
- package/test/spec/features/replace/BpmnReplace.compensation.bpmn +12 -12
- package/test/spec/features/replace/BpmnReplace.eventSubProcesses.bpmn +126 -126
- package/test/spec/features/replace/BpmnReplaceSpec.js +1302 -1302
- package/test/spec/features/replace/ReplaceRulesSpec.js +78 -78
- package/test/spec/features/replace/SubProcess-collapsed.bpmn +36 -36
- package/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js +304 -304
- package/test/spec/features/rules/BpmnRules.boundaryEvent.bpmn +93 -93
- package/test/spec/features/rules/BpmnRules.collaboration-dataAssociation.bpmn +35 -35
- package/test/spec/features/rules/BpmnRules.collaboration-lanes.bpmn +79 -79
- package/test/spec/features/rules/BpmnRules.collaboration.bpmn +138 -138
- package/test/spec/features/rules/BpmnRules.compensation.bpmn +65 -65
- package/test/spec/features/rules/BpmnRules.dataAssociation.bpmn +33 -33
- package/test/spec/features/rules/BpmnRules.eventBasedGateway.bpmn +82 -82
- package/test/spec/features/rules/BpmnRules.messageFlow.bpmn +27 -27
- package/test/spec/features/rules/BpmnRules.multiSelectionPools.bpmn +37 -37
- package/test/spec/features/rules/BpmnRules.process.bpmn +91 -91
- package/test/spec/features/rules/BpmnRules.subProcess-dataAssociation.bpmn +44 -44
- package/test/spec/features/rules/BpmnRulesSpec.js +1468 -1424
- package/test/spec/features/rules/Helper.js +82 -82
- package/test/spec/features/search/BpmnSearchProviderSpec.js +158 -158
- package/test/spec/features/search/bpmn-search-collaboration.bpmn +106 -106
- package/test/spec/features/search/bpmn-search.bpmn +100 -100
- package/test/spec/features/snapping/BpmnSnapping.connect.bpmn +36 -36
- package/test/spec/features/snapping/BpmnSnapping.labels.bpmn +27 -27
- package/test/spec/features/snapping/BpmnSnapping.lanes-resize.bpmn +43 -43
- package/test/spec/features/snapping/BpmnSnapping.participant-resize.bpmn +50 -50
- package/test/spec/features/snapping/BpmnSnapping.sequenceFlow.bpmn +41 -0
- package/test/spec/features/snapping/BpmnSnapping.subProcess-resize.bpmn +21 -21
- package/test/spec/features/snapping/BpmnSnapping.textAnnotation-resize.bpmn +22 -22
- package/test/spec/features/snapping/BpmnSnappingSpec.js +824 -758
- package/test/spec/features/snapping/BpmnSnappingUtil.lanes-flowNodes.bpmn +82 -82
- package/test/spec/features/snapping/BpmnSnappingUtil.lanes.bpmn +35 -35
- package/test/spec/features/snapping/BpmnSnappingUtilSpec.js +285 -285
- package/test/spec/i18n/custom-translate/custom-translate.js +14 -14
- package/test/spec/i18n/custom-translate/index.js +2 -2
- package/test/spec/i18n/translateSpec.js +56 -56
- package/test/spec/import/ImporterSpec.js +428 -428
- package/test/spec/import/ModelWiringSpec.js +194 -194
- package/test/spec/import/elements/AssociationSpec.collaboration.bpmn +51 -51
- package/test/spec/import/elements/AssociationSpec.compensation.bpmn +28 -28
- package/test/spec/import/elements/AssociationSpec.data-association.bpmn +39 -39
- package/test/spec/import/elements/AssociationSpec.data-input-output.bpmn +40 -40
- package/test/spec/import/elements/AssociationSpec.events.bpmn +51 -51
- package/test/spec/import/elements/AssociationSpec.js +175 -175
- package/test/spec/import/elements/AssociationSpec.text-annotation.bpmn +37 -37
- package/test/spec/import/elements/CollapsedSpec.js +118 -118
- package/test/spec/import/elements/LabelSpec.js +85 -85
- package/test/spec/import/lane-flowNodes.bpmn +44 -44
- package/test/spec/import/lane-missing-flowNodeRef.bpmn +24 -24
- package/test/spec/util/ModelCloneHelperSpec.js +381 -381
- package/test/spec/util/ModelUtilSpec.js +65 -65
- package/test/spec/util/camunda-moddle.js +70 -70
- package/test/util/MockEvents.js +62 -62
- package/test/util/ModelingUtil.js +117 -117
- package/test/util/custom-rules/CustomRules.js +18 -18
- package/test/util/custom-rules/index.js +4 -4
|
@@ -1,1957 +1,1957 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* global bootstrapModeler, inject */
|
|
4
|
-
|
|
5
|
-
var TestHelper = require('../../../TestHelper');
|
|
6
|
-
|
|
7
|
-
var globalEvent = require('../../../util/MockEvents').createEvent;
|
|
8
|
-
|
|
9
|
-
var coreModule = require('../../../../lib/core'),
|
|
10
|
-
modelingModule = require('../../../../lib/features/modeling'),
|
|
11
|
-
replaceMenuProviderModule = require('../../../../lib/features/popup-menu'),
|
|
12
|
-
customRulesModule = require('../../../util/custom-rules');
|
|
13
|
-
|
|
14
|
-
var domQuery = require('min-dom/lib/query'),
|
|
15
|
-
domClasses = require('min-dom/lib/classes'),
|
|
16
|
-
find = require('lodash/collection/find');
|
|
17
|
-
|
|
18
|
-
var is = require('../../../../lib/util/ModelUtil').is,
|
|
19
|
-
isExpanded = require('../../../../lib/util/DiUtil').isExpanded;
|
|
20
|
-
|
|
21
|
-
function queryEntry(popupMenu, id) {
|
|
22
|
-
return queryPopup(popupMenu, '[data-id="' + id + '"]');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function queryPopup(popupMenu, selector) {
|
|
26
|
-
return domQuery(selector, popupMenu._current.container);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Gets all menu entries from the current open popup menu
|
|
31
|
-
*
|
|
32
|
-
* @param {PopupMenu} popupMenu
|
|
33
|
-
*
|
|
34
|
-
* @return {<Array>}
|
|
35
|
-
*/
|
|
36
|
-
function getEntries(popupMenu) {
|
|
37
|
-
var element = popupMenu._current.element;
|
|
38
|
-
|
|
39
|
-
return popupMenu._current.provider.getEntries(element);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function triggerAction(entries, id) {
|
|
43
|
-
var entry = find(entries, { id: id });
|
|
44
|
-
|
|
45
|
-
if (!entry) {
|
|
46
|
-
throw new Error('entry "'+ id +'" not found in replace menu');
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
entry.action();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
describe('features/popup-menu - replace menu provider', function() {
|
|
54
|
-
|
|
55
|
-
var diagramXMLMarkers = require('../../../fixtures/bpmn/draw/activity-markers-simple.bpmn'),
|
|
56
|
-
diagramXMLReplace = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
|
57
|
-
|
|
58
|
-
var testModules = [
|
|
59
|
-
coreModule,
|
|
60
|
-
modelingModule,
|
|
61
|
-
replaceMenuProviderModule,
|
|
62
|
-
customRulesModule
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
var openPopup = function(element, offset) {
|
|
66
|
-
offset = offset || 100;
|
|
67
|
-
|
|
68
|
-
TestHelper.getBpmnJS().invoke(function(popupMenu) {
|
|
69
|
-
|
|
70
|
-
popupMenu.create('bpmn-replace', element);
|
|
71
|
-
|
|
72
|
-
popupMenu.open({ x: element.x + offset, y: element.y + offset });
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
describe('toggle', function() {
|
|
79
|
-
|
|
80
|
-
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
|
81
|
-
|
|
82
|
-
var toggleActive;
|
|
83
|
-
|
|
84
|
-
beforeEach(inject(function(popupMenu) {
|
|
85
|
-
toggleActive = function(entryCls) {
|
|
86
|
-
return popupMenu._getEntry(entryCls).active;
|
|
87
|
-
};
|
|
88
|
-
}));
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
describe('active attribute', function() {
|
|
92
|
-
|
|
93
|
-
it('should be true for parallel marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
94
|
-
|
|
95
|
-
// given
|
|
96
|
-
var task = elementRegistry.get('ParallelTask'),
|
|
97
|
-
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
98
|
-
|
|
99
|
-
// assume
|
|
100
|
-
expect(loopCharacteristics.isSequential).to.be.false;
|
|
101
|
-
expect(loopCharacteristics.isSequential).to.exist;
|
|
102
|
-
|
|
103
|
-
// when
|
|
104
|
-
openPopup(task);
|
|
105
|
-
|
|
106
|
-
// then
|
|
107
|
-
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
108
|
-
|
|
109
|
-
expect(toggleActive('toggle-parallel-mi')).to.be.true;
|
|
110
|
-
}));
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
it('should be true for sequential marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
114
|
-
|
|
115
|
-
// given
|
|
116
|
-
var task = elementRegistry.get('SequentialTask'),
|
|
117
|
-
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
118
|
-
|
|
119
|
-
// assume
|
|
120
|
-
expect(loopCharacteristics.isSequential).to.be.true;
|
|
121
|
-
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
122
|
-
|
|
123
|
-
// when
|
|
124
|
-
openPopup(task);
|
|
125
|
-
|
|
126
|
-
// then
|
|
127
|
-
expect(toggleActive('toggle-sequential-mi')).to.be.true;
|
|
128
|
-
}));
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
it('should be true for loop marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
132
|
-
|
|
133
|
-
// given
|
|
134
|
-
var task = elementRegistry.get('LoopTask'),
|
|
135
|
-
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
136
|
-
|
|
137
|
-
// assume
|
|
138
|
-
expect(loopCharacteristics.isSequential).not.to.exist;
|
|
139
|
-
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.false;
|
|
140
|
-
|
|
141
|
-
// when
|
|
142
|
-
openPopup(task);
|
|
143
|
-
|
|
144
|
-
// then
|
|
145
|
-
expect(toggleActive('toggle-loop')).to.be.true;
|
|
146
|
-
}));
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
it('should be true for ad hoc marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
150
|
-
|
|
151
|
-
// given
|
|
152
|
-
var AdHocSubProcess = elementRegistry.get('AdHocSubProcess');
|
|
153
|
-
|
|
154
|
-
// when
|
|
155
|
-
openPopup(AdHocSubProcess);
|
|
156
|
-
|
|
157
|
-
// then
|
|
158
|
-
expect(toggleActive('toggle-adhoc')).to.be.true;
|
|
159
|
-
}));
|
|
160
|
-
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
describe('exclusive toggle buttons', function() {
|
|
165
|
-
|
|
166
|
-
it('should not toggle non exclusive buttons off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
167
|
-
var subProcess = elementRegistry.get('AdHocSubProcess');
|
|
168
|
-
|
|
169
|
-
openPopup(subProcess);
|
|
170
|
-
|
|
171
|
-
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
172
|
-
|
|
173
|
-
// when
|
|
174
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
175
|
-
|
|
176
|
-
openPopup(subProcess);
|
|
177
|
-
|
|
178
|
-
// then
|
|
179
|
-
var adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
180
|
-
|
|
181
|
-
expect(domClasses(adHocEntry).has('active')).to.be.true;
|
|
182
|
-
}));
|
|
183
|
-
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
describe('non exclusive toggle buttons', function() {
|
|
188
|
-
|
|
189
|
-
it('should not toggle exclusive buttons off',
|
|
190
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
191
|
-
|
|
192
|
-
// given
|
|
193
|
-
var subProcess = elementRegistry.get('SubProcess');
|
|
194
|
-
|
|
195
|
-
// when
|
|
196
|
-
|
|
197
|
-
// toggle parallel on
|
|
198
|
-
openPopup(subProcess);
|
|
199
|
-
|
|
200
|
-
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
201
|
-
|
|
202
|
-
popupMenu.trigger(globalEvent(parallelEntry, { x: 0, y: 0 }));
|
|
203
|
-
|
|
204
|
-
// toggle ad hoc on
|
|
205
|
-
openPopup(subProcess);
|
|
206
|
-
|
|
207
|
-
var adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
208
|
-
|
|
209
|
-
var adHocSubProcess = popupMenu.trigger(globalEvent(adHocEntry, { x: 0, y: 0 }));
|
|
210
|
-
|
|
211
|
-
openPopup(adHocSubProcess);
|
|
212
|
-
|
|
213
|
-
// then
|
|
214
|
-
parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
215
|
-
adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
216
|
-
|
|
217
|
-
expect(domClasses(parallelEntry).has('active')).to.be.true;
|
|
218
|
-
expect(domClasses(adHocEntry).has('active')).to.be.true;
|
|
219
|
-
})
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
describe('parallel toggle button', function() {
|
|
226
|
-
|
|
227
|
-
it('should toggle parallel marker off',
|
|
228
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
229
|
-
|
|
230
|
-
// given
|
|
231
|
-
var task = elementRegistry.get('ParallelTask');
|
|
232
|
-
|
|
233
|
-
openPopup(task);
|
|
234
|
-
|
|
235
|
-
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
236
|
-
|
|
237
|
-
// when
|
|
238
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
239
|
-
|
|
240
|
-
openPopup(task);
|
|
241
|
-
|
|
242
|
-
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
243
|
-
|
|
244
|
-
// then
|
|
245
|
-
expect(task.businessObject.loopCharacteristics).not.to.exist;
|
|
246
|
-
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
247
|
-
})
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
it('should toggle parallel marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
252
|
-
|
|
253
|
-
// given
|
|
254
|
-
var task = elementRegistry.get('Task');
|
|
255
|
-
|
|
256
|
-
openPopup(task);
|
|
257
|
-
|
|
258
|
-
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
259
|
-
|
|
260
|
-
// when
|
|
261
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
262
|
-
|
|
263
|
-
openPopup(task);
|
|
264
|
-
|
|
265
|
-
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
266
|
-
|
|
267
|
-
// then
|
|
268
|
-
expect(domClasses(parallelEntry).has('active')).to.be.true;
|
|
269
|
-
expect(task.businessObject.loopCharacteristics.isSequential).to.be.false;
|
|
270
|
-
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
271
|
-
}));
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
it('should set sequential button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
275
|
-
|
|
276
|
-
// given
|
|
277
|
-
var task = elementRegistry.get('SequentialTask');
|
|
278
|
-
|
|
279
|
-
openPopup(task);
|
|
280
|
-
|
|
281
|
-
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
282
|
-
|
|
283
|
-
// when
|
|
284
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
285
|
-
|
|
286
|
-
openPopup(task);
|
|
287
|
-
|
|
288
|
-
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
289
|
-
|
|
290
|
-
// then
|
|
291
|
-
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
292
|
-
}));
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
it('should set loop button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
296
|
-
|
|
297
|
-
// given
|
|
298
|
-
var task = elementRegistry.get('LoopTask');
|
|
299
|
-
|
|
300
|
-
openPopup(task);
|
|
301
|
-
|
|
302
|
-
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
303
|
-
|
|
304
|
-
// when
|
|
305
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
306
|
-
|
|
307
|
-
openPopup(task);
|
|
308
|
-
|
|
309
|
-
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
310
|
-
|
|
311
|
-
// then
|
|
312
|
-
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
313
|
-
}));
|
|
314
|
-
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
describe('sequential toggle button', function() {
|
|
319
|
-
|
|
320
|
-
it('should toggle sequential marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
321
|
-
|
|
322
|
-
// given
|
|
323
|
-
var task = elementRegistry.get('SequentialTask');
|
|
324
|
-
|
|
325
|
-
openPopup(task);
|
|
326
|
-
|
|
327
|
-
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
328
|
-
|
|
329
|
-
// when
|
|
330
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
331
|
-
|
|
332
|
-
openPopup(task);
|
|
333
|
-
|
|
334
|
-
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
335
|
-
|
|
336
|
-
// then
|
|
337
|
-
expect(task.businessObject.loopCharacteristics).not.to.exist;
|
|
338
|
-
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
339
|
-
}));
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
it('should toggle sequential marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
343
|
-
|
|
344
|
-
// given
|
|
345
|
-
var task = elementRegistry.get('Task');
|
|
346
|
-
|
|
347
|
-
openPopup(task);
|
|
348
|
-
|
|
349
|
-
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
350
|
-
|
|
351
|
-
// when
|
|
352
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
353
|
-
|
|
354
|
-
openPopup(task);
|
|
355
|
-
|
|
356
|
-
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
357
|
-
|
|
358
|
-
// then
|
|
359
|
-
expect(domClasses(sequentialEntry).has('active')).to.be.true;
|
|
360
|
-
expect(task.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
361
|
-
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
362
|
-
}));
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
it('should set loop button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
366
|
-
|
|
367
|
-
// given
|
|
368
|
-
var task = elementRegistry.get('LoopTask');
|
|
369
|
-
|
|
370
|
-
openPopup(task);
|
|
371
|
-
|
|
372
|
-
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
373
|
-
|
|
374
|
-
// when
|
|
375
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
376
|
-
|
|
377
|
-
openPopup(task);
|
|
378
|
-
|
|
379
|
-
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
380
|
-
|
|
381
|
-
// then
|
|
382
|
-
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
383
|
-
}));
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
it('should set parallel button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
387
|
-
|
|
388
|
-
// given
|
|
389
|
-
var task = elementRegistry.get('ParallelTask');
|
|
390
|
-
|
|
391
|
-
openPopup(task);
|
|
392
|
-
|
|
393
|
-
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
394
|
-
|
|
395
|
-
// when
|
|
396
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
397
|
-
|
|
398
|
-
openPopup(task);
|
|
399
|
-
|
|
400
|
-
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
401
|
-
|
|
402
|
-
// then
|
|
403
|
-
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
404
|
-
}));
|
|
405
|
-
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
describe('loop toggle button', function() {
|
|
410
|
-
|
|
411
|
-
it('should toggle loop marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
412
|
-
|
|
413
|
-
// given
|
|
414
|
-
var task = elementRegistry.get('LoopTask');
|
|
415
|
-
|
|
416
|
-
openPopup(task);
|
|
417
|
-
|
|
418
|
-
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
419
|
-
|
|
420
|
-
// when
|
|
421
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
422
|
-
|
|
423
|
-
openPopup(task);
|
|
424
|
-
|
|
425
|
-
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
426
|
-
|
|
427
|
-
// then
|
|
428
|
-
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
429
|
-
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).not.to.exist;
|
|
430
|
-
}));
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
it('should toggle loop marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
434
|
-
|
|
435
|
-
// given
|
|
436
|
-
var task = elementRegistry.get('Task');
|
|
437
|
-
|
|
438
|
-
openPopup(task);
|
|
439
|
-
|
|
440
|
-
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
441
|
-
|
|
442
|
-
// when
|
|
443
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
444
|
-
|
|
445
|
-
openPopup(task);
|
|
446
|
-
|
|
447
|
-
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
448
|
-
|
|
449
|
-
// then
|
|
450
|
-
expect(domClasses(loopEntry).has('active')).to.be.true;
|
|
451
|
-
expect(is(task.businessObject.loopCharacteristics, 'bpmn:StandardLoopCharacteristics')).to.be.true;
|
|
452
|
-
}));
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
it('should set sequential button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
456
|
-
|
|
457
|
-
// given
|
|
458
|
-
var task = elementRegistry.get('SequentialTask');
|
|
459
|
-
|
|
460
|
-
openPopup(task);
|
|
461
|
-
|
|
462
|
-
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
463
|
-
|
|
464
|
-
// when
|
|
465
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
466
|
-
|
|
467
|
-
openPopup(task);
|
|
468
|
-
|
|
469
|
-
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
470
|
-
|
|
471
|
-
// then
|
|
472
|
-
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
473
|
-
}));
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
it('should set parallel button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
477
|
-
|
|
478
|
-
// given
|
|
479
|
-
var task = elementRegistry.get('ParallelTask');
|
|
480
|
-
|
|
481
|
-
openPopup(task);
|
|
482
|
-
|
|
483
|
-
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
484
|
-
|
|
485
|
-
// when
|
|
486
|
-
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
487
|
-
|
|
488
|
-
openPopup(task);
|
|
489
|
-
|
|
490
|
-
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
491
|
-
|
|
492
|
-
// then
|
|
493
|
-
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
494
|
-
}));
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
describe('replacing', function() {
|
|
501
|
-
|
|
502
|
-
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
|
503
|
-
|
|
504
|
-
it('should retain the loop characteristics', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
505
|
-
|
|
506
|
-
// given
|
|
507
|
-
var task = elementRegistry.get('SequentialTask');
|
|
508
|
-
|
|
509
|
-
openPopup(task);
|
|
510
|
-
|
|
511
|
-
var entry = queryEntry(popupMenu, 'replace-with-send-task');
|
|
512
|
-
|
|
513
|
-
// when
|
|
514
|
-
// replacing the task with a send task
|
|
515
|
-
var sendTask = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
516
|
-
|
|
517
|
-
// then
|
|
518
|
-
expect(sendTask.businessObject.loopCharacteristics).to.exist;
|
|
519
|
-
expect(sendTask.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
520
|
-
expect(is(sendTask.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
521
|
-
}));
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
it('should retain the loop characteristics for call activites',
|
|
525
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
526
|
-
|
|
527
|
-
// given
|
|
528
|
-
var task = elementRegistry.get('SequentialTask');
|
|
529
|
-
|
|
530
|
-
openPopup(task);
|
|
531
|
-
|
|
532
|
-
var entry = queryEntry(popupMenu, 'replace-with-call-activity');
|
|
533
|
-
|
|
534
|
-
// when
|
|
535
|
-
// replacing the task with a call activity
|
|
536
|
-
var callActivity = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
537
|
-
|
|
538
|
-
// then
|
|
539
|
-
expect(callActivity.businessObject.loopCharacteristics).to.exist;
|
|
540
|
-
expect(callActivity.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
541
|
-
expect(is(callActivity.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
542
|
-
})
|
|
543
|
-
);
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
it('should retain expanded status for sub processes',
|
|
547
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
548
|
-
|
|
549
|
-
// given
|
|
550
|
-
var subProcess = elementRegistry.get('SubProcess');
|
|
551
|
-
|
|
552
|
-
openPopup(subProcess);
|
|
553
|
-
|
|
554
|
-
var entry = queryEntry(popupMenu, 'replace-with-transaction');
|
|
555
|
-
|
|
556
|
-
// when
|
|
557
|
-
// replacing the expanded sub process with a transaction
|
|
558
|
-
var transaction = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
559
|
-
|
|
560
|
-
// then
|
|
561
|
-
expect(isExpanded(transaction)).to.equal(isExpanded(subProcess));
|
|
562
|
-
})
|
|
563
|
-
);
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
it('should replace sub processes -> event sub process',
|
|
567
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
568
|
-
|
|
569
|
-
// given
|
|
570
|
-
var subProcess = elementRegistry.get('SubProcess');
|
|
571
|
-
|
|
572
|
-
openPopup(subProcess);
|
|
573
|
-
|
|
574
|
-
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
575
|
-
|
|
576
|
-
// when
|
|
577
|
-
// replacing the expanded sub process with a eventSubProcess
|
|
578
|
-
var eventSubProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
579
|
-
|
|
580
|
-
// then
|
|
581
|
-
expect(eventSubProcess.businessObject.triggeredByEvent).to.be.true;
|
|
582
|
-
})
|
|
583
|
-
);
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
it('should replace event sub processes -> sub process',
|
|
587
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
588
|
-
|
|
589
|
-
// given
|
|
590
|
-
var eventSubProcess = elementRegistry.get('EventSubProcess');
|
|
591
|
-
|
|
592
|
-
openPopup(eventSubProcess);
|
|
593
|
-
|
|
594
|
-
var entry = queryEntry(popupMenu, 'replace-with-subprocess');
|
|
595
|
-
|
|
596
|
-
// when
|
|
597
|
-
// replacing the expanded sub process with a eventSubProcess
|
|
598
|
-
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
599
|
-
|
|
600
|
-
// then
|
|
601
|
-
expect(subProcess.businessObject.triggeredByEvent).to.be.false;
|
|
602
|
-
})
|
|
603
|
-
);
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
it('should retain the loop characteristics and the expanded status for transactions',
|
|
607
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
608
|
-
|
|
609
|
-
// given
|
|
610
|
-
var transaction = elementRegistry.get('Transaction');
|
|
611
|
-
|
|
612
|
-
openPopup(transaction);
|
|
613
|
-
|
|
614
|
-
var entry = queryEntry(popupMenu, 'replace-with-subprocess');
|
|
615
|
-
|
|
616
|
-
// when
|
|
617
|
-
// replacing the transaction with an expanded sub process
|
|
618
|
-
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
619
|
-
|
|
620
|
-
// then
|
|
621
|
-
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
|
622
|
-
})
|
|
623
|
-
);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
it('should not retain the loop characteristics morphing to an event sub process',
|
|
627
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry, modeling) {
|
|
628
|
-
|
|
629
|
-
// given
|
|
630
|
-
var transaction = elementRegistry.get('Transaction');
|
|
631
|
-
|
|
632
|
-
modeling.updateProperties(transaction, { loopCharacteristics: { isparallel: true } });
|
|
633
|
-
|
|
634
|
-
openPopup(transaction);
|
|
635
|
-
|
|
636
|
-
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
637
|
-
|
|
638
|
-
// when
|
|
639
|
-
// replacing the transaction with an event sub process
|
|
640
|
-
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
641
|
-
|
|
642
|
-
// then
|
|
643
|
-
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
|
644
|
-
})
|
|
645
|
-
);
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
it('should retain the expanded property morphing to an event sub processes',
|
|
649
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
650
|
-
|
|
651
|
-
// given
|
|
652
|
-
var transaction = elementRegistry.get('Transaction');
|
|
653
|
-
|
|
654
|
-
openPopup(transaction);
|
|
655
|
-
|
|
656
|
-
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
657
|
-
|
|
658
|
-
// when
|
|
659
|
-
// replacing the transaction with an expanded sub process
|
|
660
|
-
var eventSubProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
661
|
-
|
|
662
|
-
// then
|
|
663
|
-
expect(isExpanded(eventSubProcess)).to.equal(isExpanded(transaction));
|
|
664
|
-
})
|
|
665
|
-
);
|
|
666
|
-
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
describe('replace menu', function() {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
describe('events', function() {
|
|
674
|
-
|
|
675
|
-
beforeEach(bootstrapModeler(diagramXMLReplace, { modules: testModules }));
|
|
676
|
-
|
|
677
|
-
it('should contain all except the current one',
|
|
678
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
679
|
-
|
|
680
|
-
// given
|
|
681
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
682
|
-
|
|
683
|
-
// when
|
|
684
|
-
openPopup(startEvent);
|
|
685
|
-
|
|
686
|
-
// then
|
|
687
|
-
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
|
688
|
-
expect(getEntries(popupMenu)).to.have.length(6);
|
|
689
|
-
})
|
|
690
|
-
);
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
it('should contain all start events inside event sub process except the current one',
|
|
694
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
695
|
-
|
|
696
|
-
// given
|
|
697
|
-
var startEvent = elementRegistry.get('StartEvent_3');
|
|
698
|
-
|
|
699
|
-
// when
|
|
700
|
-
openPopup(startEvent);
|
|
701
|
-
|
|
702
|
-
// then
|
|
703
|
-
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-start')).to.be.null;
|
|
704
|
-
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.exist;
|
|
705
|
-
|
|
706
|
-
expect(getEntries(popupMenu)).to.have.length(11);
|
|
707
|
-
})
|
|
708
|
-
);
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
it('should contain all non interrupting start events inside event sub process except the current one',
|
|
712
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
713
|
-
|
|
714
|
-
// given
|
|
715
|
-
var startEvent = elementRegistry.get('StartEvent_3');
|
|
716
|
-
|
|
717
|
-
var newElement = bpmnReplace.replaceElement(startEvent, {
|
|
718
|
-
type: 'bpmn:StartEvent',
|
|
719
|
-
eventDefinitionType: 'bpmn:ConditionalEventDefinition',
|
|
720
|
-
isInterrupting: false
|
|
721
|
-
});
|
|
722
|
-
|
|
723
|
-
// when
|
|
724
|
-
openPopup(newElement);
|
|
725
|
-
|
|
726
|
-
// then
|
|
727
|
-
expect(queryEntry(popupMenu, 'replace-with-conditional-start')).to.exist;
|
|
728
|
-
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
|
729
|
-
|
|
730
|
-
expect(getEntries(popupMenu)).to.have.length(11);
|
|
731
|
-
})
|
|
732
|
-
);
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
it('should contain all intermediate events except the current one',
|
|
736
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
737
|
-
|
|
738
|
-
// given
|
|
739
|
-
var intermediateEvent = elementRegistry.get('IntermediateThrowEvent_1');
|
|
740
|
-
|
|
741
|
-
// when
|
|
742
|
-
openPopup(intermediateEvent);
|
|
743
|
-
|
|
744
|
-
// then
|
|
745
|
-
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
|
746
|
-
|
|
747
|
-
expect(getEntries(popupMenu)).to.have.length(12);
|
|
748
|
-
})
|
|
749
|
-
);
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
it('should contain all end events except the current one',
|
|
753
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
754
|
-
|
|
755
|
-
// given
|
|
756
|
-
var endEvent = elementRegistry.get('EndEvent_1');
|
|
757
|
-
|
|
758
|
-
// when
|
|
759
|
-
openPopup(endEvent);
|
|
760
|
-
|
|
761
|
-
// then
|
|
762
|
-
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
|
763
|
-
|
|
764
|
-
expect(getEntries(popupMenu)).to.have.length(8);
|
|
765
|
-
})
|
|
766
|
-
);
|
|
767
|
-
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
describe('cancel events', function() {
|
|
772
|
-
|
|
773
|
-
var diagramXML = require('../../../fixtures/bpmn/features/replace/cancel-events.bpmn');
|
|
774
|
-
|
|
775
|
-
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
776
|
-
|
|
777
|
-
it('should contain cancel event replace option',
|
|
778
|
-
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
|
779
|
-
|
|
780
|
-
// given
|
|
781
|
-
var endEvent = elementRegistry.get('EndEvent_1');
|
|
782
|
-
|
|
783
|
-
// when
|
|
784
|
-
openPopup(endEvent);
|
|
785
|
-
|
|
786
|
-
// then
|
|
787
|
-
expect(getEntries(popupMenu)).to.have.length(9);
|
|
788
|
-
})
|
|
789
|
-
);
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
it('should NOT contain cancel event replace option',
|
|
793
|
-
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
|
794
|
-
|
|
795
|
-
// given
|
|
796
|
-
var endEvent = elementRegistry.get('EndEvent_2');
|
|
797
|
-
|
|
798
|
-
// when
|
|
799
|
-
openPopup(endEvent);
|
|
800
|
-
|
|
801
|
-
// then
|
|
802
|
-
expect(getEntries(popupMenu)).to.have.length(8);
|
|
803
|
-
})
|
|
804
|
-
);
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
it('should contain cancel event replace option (boundary events)',
|
|
808
|
-
inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
809
|
-
|
|
810
|
-
// given
|
|
811
|
-
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
812
|
-
|
|
813
|
-
// when
|
|
814
|
-
openPopup(boundaryEvent);
|
|
815
|
-
|
|
816
|
-
// then
|
|
817
|
-
expect(getEntries(popupMenu)).to.have.length(13);
|
|
818
|
-
})
|
|
819
|
-
);
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
it('should NOT contain cancel event replace option (boundary events)',
|
|
823
|
-
inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
824
|
-
|
|
825
|
-
// given
|
|
826
|
-
var boundaryEvent = elementRegistry.get('BoundaryEvent_2');
|
|
827
|
-
|
|
828
|
-
// when
|
|
829
|
-
openPopup(boundaryEvent, 40);
|
|
830
|
-
|
|
831
|
-
// then
|
|
832
|
-
expect(getEntries(popupMenu)).to.have.length(13);
|
|
833
|
-
})
|
|
834
|
-
);
|
|
835
|
-
|
|
836
|
-
});
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
describe('boundary events', function() {
|
|
840
|
-
|
|
841
|
-
beforeEach(bootstrapModeler(diagramXMLReplace, { modules: testModules }));
|
|
842
|
-
|
|
843
|
-
it('should contain all boundary events for an interrupting boundary event',
|
|
844
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
845
|
-
|
|
846
|
-
// given
|
|
847
|
-
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
848
|
-
|
|
849
|
-
// when
|
|
850
|
-
openPopup(boundaryEvent, 40);
|
|
851
|
-
|
|
852
|
-
// then
|
|
853
|
-
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
|
854
|
-
expect(getEntries(popupMenu)).to.have.length(12);
|
|
855
|
-
})
|
|
856
|
-
);
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
it('should contain all boundary events for a non interrupting boundary event',
|
|
860
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
861
|
-
|
|
862
|
-
// given
|
|
863
|
-
var boundaryEvent = elementRegistry.get('BoundaryEvent_2');
|
|
864
|
-
|
|
865
|
-
// when
|
|
866
|
-
openPopup(boundaryEvent, 40);
|
|
867
|
-
|
|
868
|
-
// then
|
|
869
|
-
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
|
870
|
-
expect(getEntries(popupMenu)).to.have.length(12);
|
|
871
|
-
})
|
|
872
|
-
);
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
it('should contain compensation boundary event',
|
|
876
|
-
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
877
|
-
|
|
878
|
-
// given
|
|
879
|
-
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
880
|
-
|
|
881
|
-
// when
|
|
882
|
-
openPopup(boundaryEvent, 40);
|
|
883
|
-
|
|
884
|
-
// then
|
|
885
|
-
expect(queryEntry(popupMenu, 'replace-with-compensation-boundary')).to.exist;
|
|
886
|
-
})
|
|
887
|
-
);
|
|
888
|
-
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
describe('default flows', function() {
|
|
893
|
-
|
|
894
|
-
var diagramXML = require('./ReplaceMenuProvider.defaultFlows.bpmn');
|
|
895
|
-
|
|
896
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
897
|
-
modules: testModules
|
|
898
|
-
}));
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
it('should show default replace option [gateway]', inject(function(elementRegistry, popupMenu) {
|
|
902
|
-
// given
|
|
903
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
904
|
-
|
|
905
|
-
// when
|
|
906
|
-
openPopup(sequenceFlow);
|
|
907
|
-
|
|
908
|
-
// then
|
|
909
|
-
expect(getEntries(popupMenu)).to.have.length(1);
|
|
910
|
-
}));
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
it('should show Default replace option [task]', inject(function(elementRegistry, popupMenu) {
|
|
914
|
-
// given
|
|
915
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
916
|
-
|
|
917
|
-
// when
|
|
918
|
-
openPopup(sequenceFlow);
|
|
919
|
-
|
|
920
|
-
// then
|
|
921
|
-
expect(getEntries(popupMenu)).to.have.length(2);
|
|
922
|
-
}));
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
926
|
-
// given
|
|
927
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_4');
|
|
928
|
-
|
|
929
|
-
// when
|
|
930
|
-
openPopup(sequenceFlow);
|
|
931
|
-
|
|
932
|
-
// then
|
|
933
|
-
expect(getEntries(popupMenu)).to.have.length(0);
|
|
934
|
-
}));
|
|
935
|
-
|
|
936
|
-
});
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
describe('default flows from inclusive gateways', function() {
|
|
940
|
-
|
|
941
|
-
var diagramXML = require('./ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn');
|
|
942
|
-
|
|
943
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
944
|
-
modules: testModules
|
|
945
|
-
}));
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
949
|
-
// given
|
|
950
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
951
|
-
|
|
952
|
-
// when
|
|
953
|
-
openPopup(sequenceFlow);
|
|
954
|
-
|
|
955
|
-
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
956
|
-
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
957
|
-
|
|
958
|
-
// then
|
|
959
|
-
expect(sequenceFlowEntry).to.not.exist;
|
|
960
|
-
expect(defaultFlowEntry).to.exist;
|
|
961
|
-
}));
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
965
|
-
// given
|
|
966
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
967
|
-
|
|
968
|
-
// when
|
|
969
|
-
openPopup(sequenceFlow);
|
|
970
|
-
|
|
971
|
-
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
972
|
-
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
973
|
-
|
|
974
|
-
// then
|
|
975
|
-
expect(sequenceFlowEntry).to.exist;
|
|
976
|
-
expect(defaultFlowEntry).to.not.exist;
|
|
977
|
-
}));
|
|
978
|
-
|
|
979
|
-
});
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
describe('default flows from complex gateways', function() {
|
|
983
|
-
|
|
984
|
-
var diagramXML = require('./ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn');
|
|
985
|
-
|
|
986
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
987
|
-
modules: testModules
|
|
988
|
-
}));
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
992
|
-
// given
|
|
993
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
994
|
-
|
|
995
|
-
// when
|
|
996
|
-
openPopup(sequenceFlow);
|
|
997
|
-
|
|
998
|
-
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
999
|
-
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
1000
|
-
|
|
1001
|
-
// then
|
|
1002
|
-
expect(sequenceFlowEntry).to.not.exist;
|
|
1003
|
-
expect(defaultFlowEntry).to.exist;
|
|
1004
|
-
}));
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
1008
|
-
// given
|
|
1009
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
1010
|
-
|
|
1011
|
-
// when
|
|
1012
|
-
openPopup(sequenceFlow);
|
|
1013
|
-
|
|
1014
|
-
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
1015
|
-
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
1016
|
-
|
|
1017
|
-
// then
|
|
1018
|
-
expect(sequenceFlowEntry).to.exist;
|
|
1019
|
-
expect(defaultFlowEntry).to.not.exist;
|
|
1020
|
-
}));
|
|
1021
|
-
|
|
1022
|
-
});
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
describe('conditional flows', function() {
|
|
1026
|
-
|
|
1027
|
-
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
|
1028
|
-
|
|
1029
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
1030
|
-
modules: testModules
|
|
1031
|
-
}));
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
it('should show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
|
1035
|
-
// given
|
|
1036
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
1037
|
-
|
|
1038
|
-
// when
|
|
1039
|
-
openPopup(sequenceFlow);
|
|
1040
|
-
|
|
1041
|
-
var conditionalFlowEntry = queryEntry(popupMenu, 'replace-with-conditional-flow');
|
|
1042
|
-
|
|
1043
|
-
// then
|
|
1044
|
-
expect(conditionalFlowEntry).to.exist;
|
|
1045
|
-
|
|
1046
|
-
expect(getEntries(popupMenu)).to.have.length(2);
|
|
1047
|
-
}));
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
it('should NOT show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
|
1051
|
-
// given
|
|
1052
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
1053
|
-
|
|
1054
|
-
// when
|
|
1055
|
-
openPopup(sequenceFlow);
|
|
1056
|
-
|
|
1057
|
-
// then
|
|
1058
|
-
expect(getEntries(popupMenu)).to.have.length(0);
|
|
1059
|
-
}));
|
|
1060
|
-
|
|
1061
|
-
});
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
describe('compensate activities', function() {
|
|
1065
|
-
|
|
1066
|
-
var diagramXML = require('./ReplaceMenuProvider.compensation-activity.bpmn');
|
|
1067
|
-
|
|
1068
|
-
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
it('options should include subProcesses and callActivity', inject(function(elementRegistry, popupMenu) {
|
|
1072
|
-
|
|
1073
|
-
// given
|
|
1074
|
-
var taskElement = elementRegistry.get('Task_1');
|
|
1075
|
-
|
|
1076
|
-
// when
|
|
1077
|
-
openPopup(taskElement);
|
|
1078
|
-
|
|
1079
|
-
var callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
|
|
1080
|
-
subProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess');
|
|
1081
|
-
|
|
1082
|
-
// then
|
|
1083
|
-
expect(callActivityEntry).to.exist;
|
|
1084
|
-
expect(subProcessEntry).to.exist;
|
|
1085
|
-
}));
|
|
1086
|
-
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
describe('collapsed subprocesses', function() {
|
|
1090
|
-
|
|
1091
|
-
var diagramXML = require('./ReplaceMenuProvider.collapsedSubProcess.bpmn');
|
|
1092
|
-
|
|
1093
|
-
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
it('options do not include collapsed subprocesses itself', inject(function(elementRegistry, popupMenu) {
|
|
1097
|
-
|
|
1098
|
-
// given
|
|
1099
|
-
var collapsedSubProcess = elementRegistry.get('Task_1');
|
|
1100
|
-
|
|
1101
|
-
// when
|
|
1102
|
-
openPopup(collapsedSubProcess);
|
|
1103
|
-
|
|
1104
|
-
var collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess');
|
|
1105
|
-
|
|
1106
|
-
// then
|
|
1107
|
-
expect(collapsedSubProcessEntry).to.not.exist;
|
|
1108
|
-
}));
|
|
1109
|
-
|
|
1110
|
-
});
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
});
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
describe('integration', function() {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
describe('default flows', function() {
|
|
1120
|
-
|
|
1121
|
-
var diagramXML = require('./ReplaceMenuProvider.defaultFlows.bpmn');
|
|
1122
|
-
|
|
1123
|
-
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
it('should replace SequenceFlow with DefaultFlow [gateway]', inject(function(elementRegistry, popupMenu) {
|
|
1127
|
-
// given
|
|
1128
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
1129
|
-
|
|
1130
|
-
//when
|
|
1131
|
-
openPopup(sequenceFlow);
|
|
1132
|
-
|
|
1133
|
-
var entries = getEntries(popupMenu);
|
|
1134
|
-
|
|
1135
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1136
|
-
|
|
1137
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1138
|
-
|
|
1139
|
-
// then
|
|
1140
|
-
expect(gateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1141
|
-
}));
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
it('should replace SequenceFlow with DefaultFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1145
|
-
// given
|
|
1146
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
1147
|
-
|
|
1148
|
-
// when
|
|
1149
|
-
openPopup(sequenceFlow);
|
|
1150
|
-
|
|
1151
|
-
var entries = getEntries(popupMenu);
|
|
1152
|
-
|
|
1153
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1154
|
-
|
|
1155
|
-
var task = elementRegistry.get('Task_1ei94kl');
|
|
1156
|
-
|
|
1157
|
-
// then
|
|
1158
|
-
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1159
|
-
}));
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
it('should morph DefaultFlow into a SequenceFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1163
|
-
// given
|
|
1164
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1165
|
-
entries;
|
|
1166
|
-
|
|
1167
|
-
openPopup(sequenceFlow);
|
|
1168
|
-
|
|
1169
|
-
entries = getEntries(popupMenu);
|
|
1170
|
-
|
|
1171
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1172
|
-
|
|
1173
|
-
// when
|
|
1174
|
-
openPopup(sequenceFlow);
|
|
1175
|
-
|
|
1176
|
-
entries = getEntries(popupMenu);
|
|
1177
|
-
|
|
1178
|
-
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1179
|
-
|
|
1180
|
-
var task = elementRegistry.get('Task_1ei94kl');
|
|
1181
|
-
|
|
1182
|
-
// then
|
|
1183
|
-
expect(task.businessObject.default).to.not.exist;
|
|
1184
|
-
}));
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
it('should morph DefaultFlow into a SequenceFlow [task] -> undo',
|
|
1188
|
-
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1189
|
-
|
|
1190
|
-
// given
|
|
1191
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1192
|
-
entries;
|
|
1193
|
-
|
|
1194
|
-
openPopup(sequenceFlow);
|
|
1195
|
-
|
|
1196
|
-
entries = getEntries(popupMenu);
|
|
1197
|
-
|
|
1198
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1199
|
-
|
|
1200
|
-
// when
|
|
1201
|
-
openPopup(sequenceFlow);
|
|
1202
|
-
|
|
1203
|
-
entries = getEntries(popupMenu);
|
|
1204
|
-
|
|
1205
|
-
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1206
|
-
|
|
1207
|
-
commandStack.undo();
|
|
1208
|
-
|
|
1209
|
-
var task = elementRegistry.get('Task_1ei94kl');
|
|
1210
|
-
|
|
1211
|
-
// then
|
|
1212
|
-
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1213
|
-
})
|
|
1214
|
-
);
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
it('should morph DefaultFlow into a ConditionalFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1218
|
-
// given
|
|
1219
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1220
|
-
task = elementRegistry.get('Task_1ei94kl'),
|
|
1221
|
-
entries;
|
|
1222
|
-
|
|
1223
|
-
openPopup(sequenceFlow);
|
|
1224
|
-
|
|
1225
|
-
entries = getEntries(popupMenu);
|
|
1226
|
-
|
|
1227
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1228
|
-
|
|
1229
|
-
// when
|
|
1230
|
-
openPopup(sequenceFlow);
|
|
1231
|
-
|
|
1232
|
-
entries = getEntries(popupMenu);
|
|
1233
|
-
|
|
1234
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1235
|
-
|
|
1236
|
-
// then
|
|
1237
|
-
expect(task.businessObject.default).to.not.exist;
|
|
1238
|
-
}));
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
it('should morph DefaultFlow into a ConditionalFlow [task] -> undo',
|
|
1242
|
-
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1243
|
-
|
|
1244
|
-
// given
|
|
1245
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1246
|
-
task = elementRegistry.get('Task_1ei94kl'),
|
|
1247
|
-
entries;
|
|
1248
|
-
|
|
1249
|
-
openPopup(sequenceFlow);
|
|
1250
|
-
|
|
1251
|
-
entries = getEntries(popupMenu);
|
|
1252
|
-
|
|
1253
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1254
|
-
|
|
1255
|
-
// when
|
|
1256
|
-
openPopup(sequenceFlow);
|
|
1257
|
-
|
|
1258
|
-
entries = getEntries(popupMenu);
|
|
1259
|
-
|
|
1260
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1261
|
-
|
|
1262
|
-
commandStack.undo();
|
|
1263
|
-
|
|
1264
|
-
// then
|
|
1265
|
-
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1266
|
-
})
|
|
1267
|
-
);
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
it('should replace SequenceFlow with DefaultFlow [gateway] -> undo',
|
|
1271
|
-
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1272
|
-
|
|
1273
|
-
// given
|
|
1274
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1275
|
-
gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1276
|
-
|
|
1277
|
-
// when
|
|
1278
|
-
openPopup(sequenceFlow);
|
|
1279
|
-
|
|
1280
|
-
var entries = getEntries(popupMenu);
|
|
1281
|
-
|
|
1282
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1283
|
-
|
|
1284
|
-
commandStack.undo();
|
|
1285
|
-
|
|
1286
|
-
// then
|
|
1287
|
-
expect(gateway.businessObject.default).to.not.exist;
|
|
1288
|
-
})
|
|
1289
|
-
);
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
it('should replace SequenceFlow with DefaultFlow [task] -> undo',
|
|
1293
|
-
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1294
|
-
|
|
1295
|
-
// given
|
|
1296
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
1297
|
-
|
|
1298
|
-
// when
|
|
1299
|
-
openPopup(sequenceFlow);
|
|
1300
|
-
|
|
1301
|
-
var entries = getEntries(popupMenu);
|
|
1302
|
-
|
|
1303
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1304
|
-
|
|
1305
|
-
commandStack.undo();
|
|
1306
|
-
|
|
1307
|
-
var task = elementRegistry.get('Task_1ei94kl');
|
|
1308
|
-
|
|
1309
|
-
// then
|
|
1310
|
-
expect(task.businessObject.default).to.not.exist;
|
|
1311
|
-
})
|
|
1312
|
-
);
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
it('should only have one DefaultFlow', inject(function(elementRegistry, popupMenu) {
|
|
1316
|
-
// given
|
|
1317
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1318
|
-
sequenceFlow3 = elementRegistry.get('SequenceFlow_3');
|
|
1319
|
-
|
|
1320
|
-
var entries;
|
|
1321
|
-
|
|
1322
|
-
// when
|
|
1323
|
-
// trigger morphing sequenceFlow3 to default flow
|
|
1324
|
-
openPopup(sequenceFlow3);
|
|
1325
|
-
|
|
1326
|
-
entries = getEntries(popupMenu);
|
|
1327
|
-
|
|
1328
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1329
|
-
|
|
1330
|
-
// trigger morphing sequenceFlow to default flow
|
|
1331
|
-
openPopup(sequenceFlow);
|
|
1332
|
-
|
|
1333
|
-
entries = getEntries(popupMenu);
|
|
1334
|
-
|
|
1335
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1336
|
-
|
|
1337
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1338
|
-
|
|
1339
|
-
// then
|
|
1340
|
-
expect(gateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1341
|
-
}));
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
it('should replace DefaultFlow with SequenceFlow when changing source',
|
|
1345
|
-
inject(function(elementRegistry, popupMenu, modeling) {
|
|
1346
|
-
|
|
1347
|
-
// given
|
|
1348
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1349
|
-
task = elementRegistry.get('Task_2');
|
|
1350
|
-
|
|
1351
|
-
openPopup(sequenceFlow);
|
|
1352
|
-
|
|
1353
|
-
var entries = getEntries(popupMenu);
|
|
1354
|
-
|
|
1355
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1356
|
-
|
|
1357
|
-
// when
|
|
1358
|
-
modeling.reconnectStart(sequenceFlow, task, [
|
|
1359
|
-
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1360
|
-
{ x: 686, y: 207, original: { x: 686, y: 187 } }
|
|
1361
|
-
]);
|
|
1362
|
-
|
|
1363
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1364
|
-
|
|
1365
|
-
// then
|
|
1366
|
-
expect(gateway.businessObject.default).to.not.exist;
|
|
1367
|
-
})
|
|
1368
|
-
);
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
it('should replace DefaultFlow with SequenceFlow when changing source -> undo',
|
|
1372
|
-
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
|
1373
|
-
|
|
1374
|
-
// given
|
|
1375
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1376
|
-
task = elementRegistry.get('Task_2');
|
|
1377
|
-
|
|
1378
|
-
openPopup(sequenceFlow);
|
|
1379
|
-
|
|
1380
|
-
var entries = getEntries(popupMenu);
|
|
1381
|
-
|
|
1382
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1383
|
-
|
|
1384
|
-
// when
|
|
1385
|
-
modeling.reconnectStart(sequenceFlow, task, [
|
|
1386
|
-
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1387
|
-
{ x: 686, y: 207, original: { x: 686, y: 187 } }
|
|
1388
|
-
]);
|
|
1389
|
-
|
|
1390
|
-
commandStack.undo();
|
|
1391
|
-
|
|
1392
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1393
|
-
|
|
1394
|
-
// then
|
|
1395
|
-
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
|
1396
|
-
})
|
|
1397
|
-
);
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
[
|
|
1401
|
-
'bpmn:StartEvent'
|
|
1402
|
-
].forEach(function(type) {
|
|
1403
|
-
|
|
1404
|
-
it('should replace DefaultFlow with SequenceFlow when changing target to ' + type,
|
|
1405
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1406
|
-
|
|
1407
|
-
// given
|
|
1408
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1409
|
-
root = canvas.getRootElement();
|
|
1410
|
-
|
|
1411
|
-
var intermediateEvent = elementFactory.createShape({ type: type });
|
|
1412
|
-
|
|
1413
|
-
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
|
1414
|
-
|
|
1415
|
-
openPopup(sequenceFlow);
|
|
1416
|
-
|
|
1417
|
-
var entries = getEntries(popupMenu);
|
|
1418
|
-
|
|
1419
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1420
|
-
|
|
1421
|
-
// when
|
|
1422
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1423
|
-
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1424
|
-
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1425
|
-
]);
|
|
1426
|
-
|
|
1427
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1428
|
-
|
|
1429
|
-
// then
|
|
1430
|
-
expect(gateway.businessObject.default).to.not.exist;
|
|
1431
|
-
})
|
|
1432
|
-
);
|
|
1433
|
-
});
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
[
|
|
1437
|
-
'bpmn:Activity',
|
|
1438
|
-
'bpmn:EndEvent',
|
|
1439
|
-
'bpmn:IntermediateThrowEvent'
|
|
1440
|
-
].forEach(function(type) {
|
|
1441
|
-
|
|
1442
|
-
it('should keep DefaultFlow when changing target to ' + type,
|
|
1443
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1444
|
-
|
|
1445
|
-
// given
|
|
1446
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1447
|
-
root = canvas.getRootElement();
|
|
1448
|
-
|
|
1449
|
-
var intermediateEvent = elementFactory.createShape({ type: type });
|
|
1450
|
-
|
|
1451
|
-
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
|
1452
|
-
|
|
1453
|
-
openPopup(sequenceFlow);
|
|
1454
|
-
|
|
1455
|
-
var entries = getEntries(popupMenu);
|
|
1456
|
-
|
|
1457
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1458
|
-
|
|
1459
|
-
// when
|
|
1460
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1461
|
-
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1462
|
-
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1463
|
-
]);
|
|
1464
|
-
|
|
1465
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1466
|
-
|
|
1467
|
-
// then
|
|
1468
|
-
expect(gateway.businessObject.default).to.exist;
|
|
1469
|
-
})
|
|
1470
|
-
);
|
|
1471
|
-
});
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
it('should replace DefaultFlow with SequenceFlow when changing target -> undo',
|
|
1475
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
|
1476
|
-
|
|
1477
|
-
// given
|
|
1478
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1479
|
-
rootElement = canvas.getRootElement();
|
|
1480
|
-
|
|
1481
|
-
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
|
1482
|
-
|
|
1483
|
-
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, rootElement);
|
|
1484
|
-
|
|
1485
|
-
openPopup(sequenceFlow);
|
|
1486
|
-
|
|
1487
|
-
var entries = getEntries(popupMenu);
|
|
1488
|
-
|
|
1489
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1490
|
-
|
|
1491
|
-
// when
|
|
1492
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1493
|
-
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1494
|
-
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1495
|
-
]);
|
|
1496
|
-
|
|
1497
|
-
commandStack.undo();
|
|
1498
|
-
|
|
1499
|
-
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1500
|
-
|
|
1501
|
-
// then
|
|
1502
|
-
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
|
1503
|
-
})
|
|
1504
|
-
);
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
it('should keep DefaultFlow when morphing Gateway', inject(function(elementRegistry, popupMenu, bpmnReplace) {
|
|
1508
|
-
// given
|
|
1509
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1510
|
-
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1511
|
-
|
|
1512
|
-
// when
|
|
1513
|
-
openPopup(sequenceFlow);
|
|
1514
|
-
|
|
1515
|
-
var entries = getEntries(popupMenu);
|
|
1516
|
-
|
|
1517
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1518
|
-
|
|
1519
|
-
var inclusiveGateway = bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
|
1520
|
-
|
|
1521
|
-
// then
|
|
1522
|
-
expect(inclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1523
|
-
}));
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
it('should keep DefaultFlow when morphing Task', inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
1527
|
-
// given
|
|
1528
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1529
|
-
task = elementRegistry.get('Task_1ei94kl');
|
|
1530
|
-
|
|
1531
|
-
// when
|
|
1532
|
-
openPopup(sequenceFlow);
|
|
1533
|
-
|
|
1534
|
-
var entries = getEntries(popupMenu);
|
|
1535
|
-
|
|
1536
|
-
// trigger DefaultFlow replacement
|
|
1537
|
-
var replaceDefaultFlow = find(entries, { id: 'replace-with-default-flow' });
|
|
1538
|
-
|
|
1539
|
-
replaceDefaultFlow.action();
|
|
1540
|
-
|
|
1541
|
-
var sendTask = bpmnReplace.replaceElement(task, { type: 'bpmn:SendTask' });
|
|
1542
|
-
|
|
1543
|
-
// then
|
|
1544
|
-
expect(sendTask.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1545
|
-
}));
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
it('should keep DefaultFlow when morphing Gateway -> undo',
|
|
1549
|
-
inject(function(elementRegistry, bpmnReplace, popupMenu, commandStack) {
|
|
1550
|
-
|
|
1551
|
-
// given
|
|
1552
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1553
|
-
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1554
|
-
|
|
1555
|
-
// when
|
|
1556
|
-
openPopup(sequenceFlow);
|
|
1557
|
-
|
|
1558
|
-
var entries = getEntries(popupMenu);
|
|
1559
|
-
|
|
1560
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1561
|
-
|
|
1562
|
-
bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
|
1563
|
-
|
|
1564
|
-
commandStack.undo();
|
|
1565
|
-
|
|
1566
|
-
// then
|
|
1567
|
-
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1568
|
-
})
|
|
1569
|
-
);
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
it('should remove any conditionExpression when morphing to DefaultFlow',
|
|
1573
|
-
inject(function(elementRegistry, modeling, popupMenu, moddle) {
|
|
1574
|
-
|
|
1575
|
-
// given
|
|
1576
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1577
|
-
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1578
|
-
|
|
1579
|
-
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
|
1580
|
-
|
|
1581
|
-
modeling.updateProperties(sequenceFlow, { conditionExpression: conditionExpression });
|
|
1582
|
-
|
|
1583
|
-
// when
|
|
1584
|
-
openPopup(sequenceFlow);
|
|
1585
|
-
|
|
1586
|
-
var entries = getEntries(popupMenu);
|
|
1587
|
-
|
|
1588
|
-
// trigger DefaultFlow replacement
|
|
1589
|
-
triggerAction(entries, 'replace-with-default-flow');
|
|
1590
|
-
|
|
1591
|
-
// then
|
|
1592
|
-
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1593
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1594
|
-
})
|
|
1595
|
-
);
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
it('should remove any conditionExpression when morphing to DefaultFlow -> undo',
|
|
1599
|
-
inject(function(elementRegistry, modeling, popupMenu, moddle, commandStack) {
|
|
1600
|
-
|
|
1601
|
-
// given
|
|
1602
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1603
|
-
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1604
|
-
|
|
1605
|
-
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
|
1606
|
-
|
|
1607
|
-
modeling.updateProperties(sequenceFlow, { conditionExpression: conditionExpression });
|
|
1608
|
-
|
|
1609
|
-
// when
|
|
1610
|
-
openPopup(sequenceFlow);
|
|
1611
|
-
|
|
1612
|
-
var entries = getEntries(popupMenu);
|
|
1613
|
-
|
|
1614
|
-
// trigger DefaultFlow replacement
|
|
1615
|
-
entries[0].action();
|
|
1616
|
-
|
|
1617
|
-
commandStack.undo();
|
|
1618
|
-
|
|
1619
|
-
// then
|
|
1620
|
-
expect(exclusiveGateway.businessObject.default).to.not.exist;
|
|
1621
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.equal(conditionExpression);
|
|
1622
|
-
})
|
|
1623
|
-
);
|
|
1624
|
-
|
|
1625
|
-
});
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
describe('conditional flows', function() {
|
|
1629
|
-
|
|
1630
|
-
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
|
1631
|
-
|
|
1632
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
1633
|
-
modules: testModules
|
|
1634
|
-
}));
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
it('should morph into a ConditionalFlow', inject(function(elementRegistry, popupMenu) {
|
|
1638
|
-
// given
|
|
1639
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1640
|
-
|
|
1641
|
-
// when
|
|
1642
|
-
openPopup(sequenceFlow);
|
|
1643
|
-
|
|
1644
|
-
var entries = getEntries(popupMenu);
|
|
1645
|
-
|
|
1646
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1647
|
-
|
|
1648
|
-
// then
|
|
1649
|
-
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1650
|
-
}));
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
it('should morph into a ConditionalFlow -> undo', inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1654
|
-
// given
|
|
1655
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1656
|
-
|
|
1657
|
-
// when
|
|
1658
|
-
openPopup(sequenceFlow);
|
|
1659
|
-
|
|
1660
|
-
var entries = getEntries(popupMenu);
|
|
1661
|
-
|
|
1662
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1663
|
-
|
|
1664
|
-
commandStack.undo();
|
|
1665
|
-
|
|
1666
|
-
// then
|
|
1667
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1668
|
-
}));
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
it('should morph back into a SequenceFlow', inject(function(elementRegistry, popupMenu) {
|
|
1672
|
-
// given
|
|
1673
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1674
|
-
|
|
1675
|
-
// when
|
|
1676
|
-
openPopup(sequenceFlow);
|
|
1677
|
-
|
|
1678
|
-
var entries = getEntries(popupMenu);
|
|
1679
|
-
|
|
1680
|
-
// trigger ConditionalFlow replacement
|
|
1681
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1682
|
-
|
|
1683
|
-
openPopup(sequenceFlow);
|
|
1684
|
-
|
|
1685
|
-
entries = getEntries(popupMenu);
|
|
1686
|
-
|
|
1687
|
-
// replace with SequenceFlow
|
|
1688
|
-
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1689
|
-
|
|
1690
|
-
// then
|
|
1691
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1692
|
-
}));
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
it('should replace ConditionalFlow with SequenceFlow when changing source',
|
|
1696
|
-
inject(function(elementRegistry, popupMenu, modeling) {
|
|
1697
|
-
|
|
1698
|
-
// given
|
|
1699
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1700
|
-
startEvent = elementRegistry.get('StartEvent_1');
|
|
1701
|
-
|
|
1702
|
-
// when
|
|
1703
|
-
openPopup(sequenceFlow);
|
|
1704
|
-
|
|
1705
|
-
var entries = getEntries(popupMenu);
|
|
1706
|
-
|
|
1707
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1708
|
-
|
|
1709
|
-
// when
|
|
1710
|
-
modeling.reconnectStart(sequenceFlow, startEvent, [
|
|
1711
|
-
{ x: 196, y: 197, original: { x: 178, y: 197 } },
|
|
1712
|
-
{ x: 497, y: 278, original: { x: 547, y: 278 } }
|
|
1713
|
-
]);
|
|
1714
|
-
|
|
1715
|
-
// then
|
|
1716
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1717
|
-
})
|
|
1718
|
-
);
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
it('should replace ConditionalFlow with SequenceFlow when changing source -> undo',
|
|
1722
|
-
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
|
1723
|
-
|
|
1724
|
-
// given
|
|
1725
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1726
|
-
startEvent = elementRegistry.get('StartEvent_1');
|
|
1727
|
-
|
|
1728
|
-
// when
|
|
1729
|
-
openPopup(sequenceFlow);
|
|
1730
|
-
|
|
1731
|
-
var entries = getEntries(popupMenu);
|
|
1732
|
-
|
|
1733
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1734
|
-
|
|
1735
|
-
// when
|
|
1736
|
-
modeling.reconnectStart(sequenceFlow, startEvent, [
|
|
1737
|
-
{ x: 196, y: 197, original: { x: 178, y: 197 } },
|
|
1738
|
-
{ x: 497, y: 278, original: { x: 547, y: 278 } }
|
|
1739
|
-
]);
|
|
1740
|
-
|
|
1741
|
-
commandStack.undo();
|
|
1742
|
-
|
|
1743
|
-
// then
|
|
1744
|
-
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1745
|
-
})
|
|
1746
|
-
);
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
[
|
|
1750
|
-
'bpmn:StartEvent'
|
|
1751
|
-
].forEach(function(type) {
|
|
1752
|
-
|
|
1753
|
-
it('should replace ConditionalFlow with SequenceFlow when changing target to ' + type,
|
|
1754
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1755
|
-
|
|
1756
|
-
// given
|
|
1757
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1758
|
-
root = canvas.getRootElement(),
|
|
1759
|
-
intermediateEvent = elementFactory.createShape({ type: type });
|
|
1760
|
-
|
|
1761
|
-
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1762
|
-
|
|
1763
|
-
openPopup(sequenceFlow);
|
|
1764
|
-
|
|
1765
|
-
var entries = getEntries(popupMenu);
|
|
1766
|
-
|
|
1767
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1768
|
-
|
|
1769
|
-
// when
|
|
1770
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1771
|
-
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1772
|
-
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1773
|
-
]);
|
|
1774
|
-
|
|
1775
|
-
// then
|
|
1776
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1777
|
-
})
|
|
1778
|
-
);
|
|
1779
|
-
|
|
1780
|
-
});
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
[
|
|
1784
|
-
'bpmn:Activity',
|
|
1785
|
-
'bpmn:EndEvent',
|
|
1786
|
-
'bpmn:IntermediateThrowEvent'
|
|
1787
|
-
].forEach(function(type) {
|
|
1788
|
-
|
|
1789
|
-
it('should keep ConditionalFlow when changing target to ' + type,
|
|
1790
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1791
|
-
|
|
1792
|
-
// given
|
|
1793
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1794
|
-
root = canvas.getRootElement(),
|
|
1795
|
-
intermediateEvent = elementFactory.createShape({ type: type });
|
|
1796
|
-
|
|
1797
|
-
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1798
|
-
|
|
1799
|
-
openPopup(sequenceFlow);
|
|
1800
|
-
|
|
1801
|
-
var entries = getEntries(popupMenu);
|
|
1802
|
-
|
|
1803
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1804
|
-
|
|
1805
|
-
// when
|
|
1806
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1807
|
-
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1808
|
-
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1809
|
-
]);
|
|
1810
|
-
|
|
1811
|
-
// then
|
|
1812
|
-
expect(sequenceFlow.businessObject.conditionExpression).to.exist;
|
|
1813
|
-
})
|
|
1814
|
-
);
|
|
1815
|
-
|
|
1816
|
-
});
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
it('should replace ConditionalFlow with SequenceFlow when changing target -> undo',
|
|
1820
|
-
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
|
1821
|
-
|
|
1822
|
-
// given
|
|
1823
|
-
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1824
|
-
root = canvas.getRootElement(),
|
|
1825
|
-
intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
|
1826
|
-
|
|
1827
|
-
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1828
|
-
|
|
1829
|
-
openPopup(sequenceFlow);
|
|
1830
|
-
|
|
1831
|
-
var entries = getEntries(popupMenu);
|
|
1832
|
-
|
|
1833
|
-
// trigger ConditionalFlow replacement
|
|
1834
|
-
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1835
|
-
|
|
1836
|
-
// when
|
|
1837
|
-
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1838
|
-
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1839
|
-
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1840
|
-
]);
|
|
1841
|
-
|
|
1842
|
-
commandStack.undo();
|
|
1843
|
-
|
|
1844
|
-
// then
|
|
1845
|
-
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1846
|
-
})
|
|
1847
|
-
);
|
|
1848
|
-
|
|
1849
|
-
});
|
|
1850
|
-
|
|
1851
|
-
});
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
describe('rules', function() {
|
|
1855
|
-
|
|
1856
|
-
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
|
|
1857
|
-
|
|
1858
|
-
beforeEach(bootstrapModeler(diagramXML, {
|
|
1859
|
-
modules: testModules.concat([ customRulesModule ])
|
|
1860
|
-
}));
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
it('should get entries by default', inject(function(elementRegistry, popupMenu) {
|
|
1864
|
-
|
|
1865
|
-
// given
|
|
1866
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1867
|
-
|
|
1868
|
-
// when
|
|
1869
|
-
openPopup(startEvent);
|
|
1870
|
-
|
|
1871
|
-
var entries = getEntries(popupMenu);
|
|
1872
|
-
|
|
1873
|
-
// then
|
|
1874
|
-
expect(entries).to.have.length.above(0);
|
|
1875
|
-
}));
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
it('should get entries when custom rule returns true',
|
|
1879
|
-
inject(function(elementRegistry, popupMenu, customRules) {
|
|
1880
|
-
|
|
1881
|
-
// given
|
|
1882
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1883
|
-
|
|
1884
|
-
customRules.addRule('shape.replace', function() {
|
|
1885
|
-
return true;
|
|
1886
|
-
});
|
|
1887
|
-
|
|
1888
|
-
//when
|
|
1889
|
-
openPopup(startEvent);
|
|
1890
|
-
|
|
1891
|
-
var entries = getEntries(popupMenu);
|
|
1892
|
-
|
|
1893
|
-
// then
|
|
1894
|
-
expect(entries).to.have.length.above(0);
|
|
1895
|
-
})
|
|
1896
|
-
);
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
it('should get no entries when custom rule returns false',
|
|
1900
|
-
inject(function(elementRegistry, popupMenu, customRules) {
|
|
1901
|
-
|
|
1902
|
-
// given
|
|
1903
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1904
|
-
|
|
1905
|
-
customRules.addRule('shape.replace', function() {
|
|
1906
|
-
return false;
|
|
1907
|
-
});
|
|
1908
|
-
|
|
1909
|
-
// when
|
|
1910
|
-
openPopup(startEvent);
|
|
1911
|
-
|
|
1912
|
-
var entries = getEntries(popupMenu);
|
|
1913
|
-
|
|
1914
|
-
// then
|
|
1915
|
-
expect(entries).to.have.length(0);
|
|
1916
|
-
})
|
|
1917
|
-
);
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
it('should provide element to custom rules', inject(function(elementRegistry, popupMenu, customRules) {
|
|
1921
|
-
|
|
1922
|
-
// given
|
|
1923
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1924
|
-
var actual;
|
|
1925
|
-
|
|
1926
|
-
customRules.addRule('shape.replace', function(context) {
|
|
1927
|
-
actual = context.element;
|
|
1928
|
-
});
|
|
1929
|
-
|
|
1930
|
-
// when
|
|
1931
|
-
openPopup(startEvent);
|
|
1932
|
-
|
|
1933
|
-
// then
|
|
1934
|
-
expect(actual).to.equal(startEvent);
|
|
1935
|
-
}));
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
it('should evaluate rule once', inject(function(elementRegistry, popupMenu, customRules) {
|
|
1939
|
-
|
|
1940
|
-
// given
|
|
1941
|
-
var callCount = 0;
|
|
1942
|
-
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1943
|
-
|
|
1944
|
-
customRules.addRule('shape.replace', function() {
|
|
1945
|
-
callCount++;
|
|
1946
|
-
});
|
|
1947
|
-
|
|
1948
|
-
// when
|
|
1949
|
-
openPopup(startEvent);
|
|
1950
|
-
|
|
1951
|
-
// then
|
|
1952
|
-
expect(callCount).to.equal(1);
|
|
1953
|
-
}));
|
|
1954
|
-
|
|
1955
|
-
});
|
|
1956
|
-
|
|
1957
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* global bootstrapModeler, inject */
|
|
4
|
+
|
|
5
|
+
var TestHelper = require('../../../TestHelper');
|
|
6
|
+
|
|
7
|
+
var globalEvent = require('../../../util/MockEvents').createEvent;
|
|
8
|
+
|
|
9
|
+
var coreModule = require('../../../../lib/core'),
|
|
10
|
+
modelingModule = require('../../../../lib/features/modeling'),
|
|
11
|
+
replaceMenuProviderModule = require('../../../../lib/features/popup-menu'),
|
|
12
|
+
customRulesModule = require('../../../util/custom-rules');
|
|
13
|
+
|
|
14
|
+
var domQuery = require('min-dom/lib/query'),
|
|
15
|
+
domClasses = require('min-dom/lib/classes'),
|
|
16
|
+
find = require('lodash/collection/find');
|
|
17
|
+
|
|
18
|
+
var is = require('../../../../lib/util/ModelUtil').is,
|
|
19
|
+
isExpanded = require('../../../../lib/util/DiUtil').isExpanded;
|
|
20
|
+
|
|
21
|
+
function queryEntry(popupMenu, id) {
|
|
22
|
+
return queryPopup(popupMenu, '[data-id="' + id + '"]');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function queryPopup(popupMenu, selector) {
|
|
26
|
+
return domQuery(selector, popupMenu._current.container);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets all menu entries from the current open popup menu
|
|
31
|
+
*
|
|
32
|
+
* @param {PopupMenu} popupMenu
|
|
33
|
+
*
|
|
34
|
+
* @return {<Array>}
|
|
35
|
+
*/
|
|
36
|
+
function getEntries(popupMenu) {
|
|
37
|
+
var element = popupMenu._current.element;
|
|
38
|
+
|
|
39
|
+
return popupMenu._current.provider.getEntries(element);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function triggerAction(entries, id) {
|
|
43
|
+
var entry = find(entries, { id: id });
|
|
44
|
+
|
|
45
|
+
if (!entry) {
|
|
46
|
+
throw new Error('entry "'+ id +'" not found in replace menu');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
entry.action();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
describe('features/popup-menu - replace menu provider', function() {
|
|
54
|
+
|
|
55
|
+
var diagramXMLMarkers = require('../../../fixtures/bpmn/draw/activity-markers-simple.bpmn'),
|
|
56
|
+
diagramXMLReplace = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
|
57
|
+
|
|
58
|
+
var testModules = [
|
|
59
|
+
coreModule,
|
|
60
|
+
modelingModule,
|
|
61
|
+
replaceMenuProviderModule,
|
|
62
|
+
customRulesModule
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
var openPopup = function(element, offset) {
|
|
66
|
+
offset = offset || 100;
|
|
67
|
+
|
|
68
|
+
TestHelper.getBpmnJS().invoke(function(popupMenu) {
|
|
69
|
+
|
|
70
|
+
popupMenu.create('bpmn-replace', element);
|
|
71
|
+
|
|
72
|
+
popupMenu.open({ x: element.x + offset, y: element.y + offset });
|
|
73
|
+
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
describe('toggle', function() {
|
|
79
|
+
|
|
80
|
+
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
|
81
|
+
|
|
82
|
+
var toggleActive;
|
|
83
|
+
|
|
84
|
+
beforeEach(inject(function(popupMenu) {
|
|
85
|
+
toggleActive = function(entryCls) {
|
|
86
|
+
return popupMenu._getEntry(entryCls).active;
|
|
87
|
+
};
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
describe('active attribute', function() {
|
|
92
|
+
|
|
93
|
+
it('should be true for parallel marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
94
|
+
|
|
95
|
+
// given
|
|
96
|
+
var task = elementRegistry.get('ParallelTask'),
|
|
97
|
+
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
98
|
+
|
|
99
|
+
// assume
|
|
100
|
+
expect(loopCharacteristics.isSequential).to.be.false;
|
|
101
|
+
expect(loopCharacteristics.isSequential).to.exist;
|
|
102
|
+
|
|
103
|
+
// when
|
|
104
|
+
openPopup(task);
|
|
105
|
+
|
|
106
|
+
// then
|
|
107
|
+
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
108
|
+
|
|
109
|
+
expect(toggleActive('toggle-parallel-mi')).to.be.true;
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
it('should be true for sequential marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
114
|
+
|
|
115
|
+
// given
|
|
116
|
+
var task = elementRegistry.get('SequentialTask'),
|
|
117
|
+
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
118
|
+
|
|
119
|
+
// assume
|
|
120
|
+
expect(loopCharacteristics.isSequential).to.be.true;
|
|
121
|
+
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
122
|
+
|
|
123
|
+
// when
|
|
124
|
+
openPopup(task);
|
|
125
|
+
|
|
126
|
+
// then
|
|
127
|
+
expect(toggleActive('toggle-sequential-mi')).to.be.true;
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
it('should be true for loop marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
132
|
+
|
|
133
|
+
// given
|
|
134
|
+
var task = elementRegistry.get('LoopTask'),
|
|
135
|
+
loopCharacteristics = task.businessObject.loopCharacteristics;
|
|
136
|
+
|
|
137
|
+
// assume
|
|
138
|
+
expect(loopCharacteristics.isSequential).not.to.exist;
|
|
139
|
+
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.false;
|
|
140
|
+
|
|
141
|
+
// when
|
|
142
|
+
openPopup(task);
|
|
143
|
+
|
|
144
|
+
// then
|
|
145
|
+
expect(toggleActive('toggle-loop')).to.be.true;
|
|
146
|
+
}));
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
it('should be true for ad hoc marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
150
|
+
|
|
151
|
+
// given
|
|
152
|
+
var AdHocSubProcess = elementRegistry.get('AdHocSubProcess');
|
|
153
|
+
|
|
154
|
+
// when
|
|
155
|
+
openPopup(AdHocSubProcess);
|
|
156
|
+
|
|
157
|
+
// then
|
|
158
|
+
expect(toggleActive('toggle-adhoc')).to.be.true;
|
|
159
|
+
}));
|
|
160
|
+
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
describe('exclusive toggle buttons', function() {
|
|
165
|
+
|
|
166
|
+
it('should not toggle non exclusive buttons off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
167
|
+
var subProcess = elementRegistry.get('AdHocSubProcess');
|
|
168
|
+
|
|
169
|
+
openPopup(subProcess);
|
|
170
|
+
|
|
171
|
+
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
172
|
+
|
|
173
|
+
// when
|
|
174
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
175
|
+
|
|
176
|
+
openPopup(subProcess);
|
|
177
|
+
|
|
178
|
+
// then
|
|
179
|
+
var adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
180
|
+
|
|
181
|
+
expect(domClasses(adHocEntry).has('active')).to.be.true;
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
describe('non exclusive toggle buttons', function() {
|
|
188
|
+
|
|
189
|
+
it('should not toggle exclusive buttons off',
|
|
190
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
191
|
+
|
|
192
|
+
// given
|
|
193
|
+
var subProcess = elementRegistry.get('SubProcess');
|
|
194
|
+
|
|
195
|
+
// when
|
|
196
|
+
|
|
197
|
+
// toggle parallel on
|
|
198
|
+
openPopup(subProcess);
|
|
199
|
+
|
|
200
|
+
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
201
|
+
|
|
202
|
+
popupMenu.trigger(globalEvent(parallelEntry, { x: 0, y: 0 }));
|
|
203
|
+
|
|
204
|
+
// toggle ad hoc on
|
|
205
|
+
openPopup(subProcess);
|
|
206
|
+
|
|
207
|
+
var adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
208
|
+
|
|
209
|
+
var adHocSubProcess = popupMenu.trigger(globalEvent(adHocEntry, { x: 0, y: 0 }));
|
|
210
|
+
|
|
211
|
+
openPopup(adHocSubProcess);
|
|
212
|
+
|
|
213
|
+
// then
|
|
214
|
+
parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
215
|
+
adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
|
|
216
|
+
|
|
217
|
+
expect(domClasses(parallelEntry).has('active')).to.be.true;
|
|
218
|
+
expect(domClasses(adHocEntry).has('active')).to.be.true;
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
describe('parallel toggle button', function() {
|
|
226
|
+
|
|
227
|
+
it('should toggle parallel marker off',
|
|
228
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
229
|
+
|
|
230
|
+
// given
|
|
231
|
+
var task = elementRegistry.get('ParallelTask');
|
|
232
|
+
|
|
233
|
+
openPopup(task);
|
|
234
|
+
|
|
235
|
+
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
236
|
+
|
|
237
|
+
// when
|
|
238
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
239
|
+
|
|
240
|
+
openPopup(task);
|
|
241
|
+
|
|
242
|
+
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
243
|
+
|
|
244
|
+
// then
|
|
245
|
+
expect(task.businessObject.loopCharacteristics).not.to.exist;
|
|
246
|
+
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
247
|
+
})
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
it('should toggle parallel marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
252
|
+
|
|
253
|
+
// given
|
|
254
|
+
var task = elementRegistry.get('Task');
|
|
255
|
+
|
|
256
|
+
openPopup(task);
|
|
257
|
+
|
|
258
|
+
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
259
|
+
|
|
260
|
+
// when
|
|
261
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
262
|
+
|
|
263
|
+
openPopup(task);
|
|
264
|
+
|
|
265
|
+
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
266
|
+
|
|
267
|
+
// then
|
|
268
|
+
expect(domClasses(parallelEntry).has('active')).to.be.true;
|
|
269
|
+
expect(task.businessObject.loopCharacteristics.isSequential).to.be.false;
|
|
270
|
+
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
271
|
+
}));
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
it('should set sequential button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
275
|
+
|
|
276
|
+
// given
|
|
277
|
+
var task = elementRegistry.get('SequentialTask');
|
|
278
|
+
|
|
279
|
+
openPopup(task);
|
|
280
|
+
|
|
281
|
+
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
282
|
+
|
|
283
|
+
// when
|
|
284
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
285
|
+
|
|
286
|
+
openPopup(task);
|
|
287
|
+
|
|
288
|
+
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
289
|
+
|
|
290
|
+
// then
|
|
291
|
+
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
292
|
+
}));
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
it('should set loop button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
296
|
+
|
|
297
|
+
// given
|
|
298
|
+
var task = elementRegistry.get('LoopTask');
|
|
299
|
+
|
|
300
|
+
openPopup(task);
|
|
301
|
+
|
|
302
|
+
var entry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
303
|
+
|
|
304
|
+
// when
|
|
305
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
306
|
+
|
|
307
|
+
openPopup(task);
|
|
308
|
+
|
|
309
|
+
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
310
|
+
|
|
311
|
+
// then
|
|
312
|
+
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
313
|
+
}));
|
|
314
|
+
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
describe('sequential toggle button', function() {
|
|
319
|
+
|
|
320
|
+
it('should toggle sequential marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
321
|
+
|
|
322
|
+
// given
|
|
323
|
+
var task = elementRegistry.get('SequentialTask');
|
|
324
|
+
|
|
325
|
+
openPopup(task);
|
|
326
|
+
|
|
327
|
+
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
328
|
+
|
|
329
|
+
// when
|
|
330
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
331
|
+
|
|
332
|
+
openPopup(task);
|
|
333
|
+
|
|
334
|
+
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
335
|
+
|
|
336
|
+
// then
|
|
337
|
+
expect(task.businessObject.loopCharacteristics).not.to.exist;
|
|
338
|
+
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
339
|
+
}));
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
it('should toggle sequential marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
343
|
+
|
|
344
|
+
// given
|
|
345
|
+
var task = elementRegistry.get('Task');
|
|
346
|
+
|
|
347
|
+
openPopup(task);
|
|
348
|
+
|
|
349
|
+
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
350
|
+
|
|
351
|
+
// when
|
|
352
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
353
|
+
|
|
354
|
+
openPopup(task);
|
|
355
|
+
|
|
356
|
+
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
357
|
+
|
|
358
|
+
// then
|
|
359
|
+
expect(domClasses(sequentialEntry).has('active')).to.be.true;
|
|
360
|
+
expect(task.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
361
|
+
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
362
|
+
}));
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
it('should set loop button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
366
|
+
|
|
367
|
+
// given
|
|
368
|
+
var task = elementRegistry.get('LoopTask');
|
|
369
|
+
|
|
370
|
+
openPopup(task);
|
|
371
|
+
|
|
372
|
+
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
373
|
+
|
|
374
|
+
// when
|
|
375
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
376
|
+
|
|
377
|
+
openPopup(task);
|
|
378
|
+
|
|
379
|
+
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
380
|
+
|
|
381
|
+
// then
|
|
382
|
+
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
383
|
+
}));
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
it('should set parallel button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
387
|
+
|
|
388
|
+
// given
|
|
389
|
+
var task = elementRegistry.get('ParallelTask');
|
|
390
|
+
|
|
391
|
+
openPopup(task);
|
|
392
|
+
|
|
393
|
+
var entry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
394
|
+
|
|
395
|
+
// when
|
|
396
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
397
|
+
|
|
398
|
+
openPopup(task);
|
|
399
|
+
|
|
400
|
+
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
401
|
+
|
|
402
|
+
// then
|
|
403
|
+
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
404
|
+
}));
|
|
405
|
+
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
describe('loop toggle button', function() {
|
|
410
|
+
|
|
411
|
+
it('should toggle loop marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
412
|
+
|
|
413
|
+
// given
|
|
414
|
+
var task = elementRegistry.get('LoopTask');
|
|
415
|
+
|
|
416
|
+
openPopup(task);
|
|
417
|
+
|
|
418
|
+
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
419
|
+
|
|
420
|
+
// when
|
|
421
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
422
|
+
|
|
423
|
+
openPopup(task);
|
|
424
|
+
|
|
425
|
+
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
426
|
+
|
|
427
|
+
// then
|
|
428
|
+
expect(domClasses(loopEntry).has('active')).to.be.false;
|
|
429
|
+
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).not.to.exist;
|
|
430
|
+
}));
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
it('should toggle loop marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
434
|
+
|
|
435
|
+
// given
|
|
436
|
+
var task = elementRegistry.get('Task');
|
|
437
|
+
|
|
438
|
+
openPopup(task);
|
|
439
|
+
|
|
440
|
+
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
441
|
+
|
|
442
|
+
// when
|
|
443
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
444
|
+
|
|
445
|
+
openPopup(task);
|
|
446
|
+
|
|
447
|
+
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
|
|
448
|
+
|
|
449
|
+
// then
|
|
450
|
+
expect(domClasses(loopEntry).has('active')).to.be.true;
|
|
451
|
+
expect(is(task.businessObject.loopCharacteristics, 'bpmn:StandardLoopCharacteristics')).to.be.true;
|
|
452
|
+
}));
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
it('should set sequential button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
456
|
+
|
|
457
|
+
// given
|
|
458
|
+
var task = elementRegistry.get('SequentialTask');
|
|
459
|
+
|
|
460
|
+
openPopup(task);
|
|
461
|
+
|
|
462
|
+
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
463
|
+
|
|
464
|
+
// when
|
|
465
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
466
|
+
|
|
467
|
+
openPopup(task);
|
|
468
|
+
|
|
469
|
+
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
|
|
470
|
+
|
|
471
|
+
// then
|
|
472
|
+
expect(domClasses(sequentialEntry).has('active')).to.be.false;
|
|
473
|
+
}));
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
it('should set parallel button inactive', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
477
|
+
|
|
478
|
+
// given
|
|
479
|
+
var task = elementRegistry.get('ParallelTask');
|
|
480
|
+
|
|
481
|
+
openPopup(task);
|
|
482
|
+
|
|
483
|
+
var entry = queryEntry(popupMenu, 'toggle-loop');
|
|
484
|
+
|
|
485
|
+
// when
|
|
486
|
+
popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
487
|
+
|
|
488
|
+
openPopup(task);
|
|
489
|
+
|
|
490
|
+
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
|
|
491
|
+
|
|
492
|
+
// then
|
|
493
|
+
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
|
494
|
+
}));
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
describe('replacing', function() {
|
|
501
|
+
|
|
502
|
+
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
|
503
|
+
|
|
504
|
+
it('should retain the loop characteristics', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
505
|
+
|
|
506
|
+
// given
|
|
507
|
+
var task = elementRegistry.get('SequentialTask');
|
|
508
|
+
|
|
509
|
+
openPopup(task);
|
|
510
|
+
|
|
511
|
+
var entry = queryEntry(popupMenu, 'replace-with-send-task');
|
|
512
|
+
|
|
513
|
+
// when
|
|
514
|
+
// replacing the task with a send task
|
|
515
|
+
var sendTask = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
516
|
+
|
|
517
|
+
// then
|
|
518
|
+
expect(sendTask.businessObject.loopCharacteristics).to.exist;
|
|
519
|
+
expect(sendTask.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
520
|
+
expect(is(sendTask.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
521
|
+
}));
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
it('should retain the loop characteristics for call activites',
|
|
525
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
526
|
+
|
|
527
|
+
// given
|
|
528
|
+
var task = elementRegistry.get('SequentialTask');
|
|
529
|
+
|
|
530
|
+
openPopup(task);
|
|
531
|
+
|
|
532
|
+
var entry = queryEntry(popupMenu, 'replace-with-call-activity');
|
|
533
|
+
|
|
534
|
+
// when
|
|
535
|
+
// replacing the task with a call activity
|
|
536
|
+
var callActivity = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
537
|
+
|
|
538
|
+
// then
|
|
539
|
+
expect(callActivity.businessObject.loopCharacteristics).to.exist;
|
|
540
|
+
expect(callActivity.businessObject.loopCharacteristics.isSequential).to.be.true;
|
|
541
|
+
expect(is(callActivity.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
542
|
+
})
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
it('should retain expanded status for sub processes',
|
|
547
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
548
|
+
|
|
549
|
+
// given
|
|
550
|
+
var subProcess = elementRegistry.get('SubProcess');
|
|
551
|
+
|
|
552
|
+
openPopup(subProcess);
|
|
553
|
+
|
|
554
|
+
var entry = queryEntry(popupMenu, 'replace-with-transaction');
|
|
555
|
+
|
|
556
|
+
// when
|
|
557
|
+
// replacing the expanded sub process with a transaction
|
|
558
|
+
var transaction = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
559
|
+
|
|
560
|
+
// then
|
|
561
|
+
expect(isExpanded(transaction)).to.equal(isExpanded(subProcess));
|
|
562
|
+
})
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
it('should replace sub processes -> event sub process',
|
|
567
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
568
|
+
|
|
569
|
+
// given
|
|
570
|
+
var subProcess = elementRegistry.get('SubProcess');
|
|
571
|
+
|
|
572
|
+
openPopup(subProcess);
|
|
573
|
+
|
|
574
|
+
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
575
|
+
|
|
576
|
+
// when
|
|
577
|
+
// replacing the expanded sub process with a eventSubProcess
|
|
578
|
+
var eventSubProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
579
|
+
|
|
580
|
+
// then
|
|
581
|
+
expect(eventSubProcess.businessObject.triggeredByEvent).to.be.true;
|
|
582
|
+
})
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
it('should replace event sub processes -> sub process',
|
|
587
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
588
|
+
|
|
589
|
+
// given
|
|
590
|
+
var eventSubProcess = elementRegistry.get('EventSubProcess');
|
|
591
|
+
|
|
592
|
+
openPopup(eventSubProcess);
|
|
593
|
+
|
|
594
|
+
var entry = queryEntry(popupMenu, 'replace-with-subprocess');
|
|
595
|
+
|
|
596
|
+
// when
|
|
597
|
+
// replacing the expanded sub process with a eventSubProcess
|
|
598
|
+
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
599
|
+
|
|
600
|
+
// then
|
|
601
|
+
expect(subProcess.businessObject.triggeredByEvent).to.be.false;
|
|
602
|
+
})
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
it('should retain the loop characteristics and the expanded status for transactions',
|
|
607
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
608
|
+
|
|
609
|
+
// given
|
|
610
|
+
var transaction = elementRegistry.get('Transaction');
|
|
611
|
+
|
|
612
|
+
openPopup(transaction);
|
|
613
|
+
|
|
614
|
+
var entry = queryEntry(popupMenu, 'replace-with-subprocess');
|
|
615
|
+
|
|
616
|
+
// when
|
|
617
|
+
// replacing the transaction with an expanded sub process
|
|
618
|
+
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
619
|
+
|
|
620
|
+
// then
|
|
621
|
+
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
|
622
|
+
})
|
|
623
|
+
);
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
it('should not retain the loop characteristics morphing to an event sub process',
|
|
627
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry, modeling) {
|
|
628
|
+
|
|
629
|
+
// given
|
|
630
|
+
var transaction = elementRegistry.get('Transaction');
|
|
631
|
+
|
|
632
|
+
modeling.updateProperties(transaction, { loopCharacteristics: { isparallel: true } });
|
|
633
|
+
|
|
634
|
+
openPopup(transaction);
|
|
635
|
+
|
|
636
|
+
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
637
|
+
|
|
638
|
+
// when
|
|
639
|
+
// replacing the transaction with an event sub process
|
|
640
|
+
var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
641
|
+
|
|
642
|
+
// then
|
|
643
|
+
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
|
644
|
+
})
|
|
645
|
+
);
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
it('should retain the expanded property morphing to an event sub processes',
|
|
649
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
650
|
+
|
|
651
|
+
// given
|
|
652
|
+
var transaction = elementRegistry.get('Transaction');
|
|
653
|
+
|
|
654
|
+
openPopup(transaction);
|
|
655
|
+
|
|
656
|
+
var entry = queryEntry(popupMenu, 'replace-with-event-subprocess');
|
|
657
|
+
|
|
658
|
+
// when
|
|
659
|
+
// replacing the transaction with an expanded sub process
|
|
660
|
+
var eventSubProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 }));
|
|
661
|
+
|
|
662
|
+
// then
|
|
663
|
+
expect(isExpanded(eventSubProcess)).to.equal(isExpanded(transaction));
|
|
664
|
+
})
|
|
665
|
+
);
|
|
666
|
+
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
describe('replace menu', function() {
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
describe('events', function() {
|
|
674
|
+
|
|
675
|
+
beforeEach(bootstrapModeler(diagramXMLReplace, { modules: testModules }));
|
|
676
|
+
|
|
677
|
+
it('should contain all except the current one',
|
|
678
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
679
|
+
|
|
680
|
+
// given
|
|
681
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
682
|
+
|
|
683
|
+
// when
|
|
684
|
+
openPopup(startEvent);
|
|
685
|
+
|
|
686
|
+
// then
|
|
687
|
+
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
|
688
|
+
expect(getEntries(popupMenu)).to.have.length(6);
|
|
689
|
+
})
|
|
690
|
+
);
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
it('should contain all start events inside event sub process except the current one',
|
|
694
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
695
|
+
|
|
696
|
+
// given
|
|
697
|
+
var startEvent = elementRegistry.get('StartEvent_3');
|
|
698
|
+
|
|
699
|
+
// when
|
|
700
|
+
openPopup(startEvent);
|
|
701
|
+
|
|
702
|
+
// then
|
|
703
|
+
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-start')).to.be.null;
|
|
704
|
+
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.exist;
|
|
705
|
+
|
|
706
|
+
expect(getEntries(popupMenu)).to.have.length(11);
|
|
707
|
+
})
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
it('should contain all non interrupting start events inside event sub process except the current one',
|
|
712
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
713
|
+
|
|
714
|
+
// given
|
|
715
|
+
var startEvent = elementRegistry.get('StartEvent_3');
|
|
716
|
+
|
|
717
|
+
var newElement = bpmnReplace.replaceElement(startEvent, {
|
|
718
|
+
type: 'bpmn:StartEvent',
|
|
719
|
+
eventDefinitionType: 'bpmn:ConditionalEventDefinition',
|
|
720
|
+
isInterrupting: false
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// when
|
|
724
|
+
openPopup(newElement);
|
|
725
|
+
|
|
726
|
+
// then
|
|
727
|
+
expect(queryEntry(popupMenu, 'replace-with-conditional-start')).to.exist;
|
|
728
|
+
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
|
729
|
+
|
|
730
|
+
expect(getEntries(popupMenu)).to.have.length(11);
|
|
731
|
+
})
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
it('should contain all intermediate events except the current one',
|
|
736
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
737
|
+
|
|
738
|
+
// given
|
|
739
|
+
var intermediateEvent = elementRegistry.get('IntermediateThrowEvent_1');
|
|
740
|
+
|
|
741
|
+
// when
|
|
742
|
+
openPopup(intermediateEvent);
|
|
743
|
+
|
|
744
|
+
// then
|
|
745
|
+
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
|
746
|
+
|
|
747
|
+
expect(getEntries(popupMenu)).to.have.length(12);
|
|
748
|
+
})
|
|
749
|
+
);
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
it('should contain all end events except the current one',
|
|
753
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
754
|
+
|
|
755
|
+
// given
|
|
756
|
+
var endEvent = elementRegistry.get('EndEvent_1');
|
|
757
|
+
|
|
758
|
+
// when
|
|
759
|
+
openPopup(endEvent);
|
|
760
|
+
|
|
761
|
+
// then
|
|
762
|
+
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
|
763
|
+
|
|
764
|
+
expect(getEntries(popupMenu)).to.have.length(8);
|
|
765
|
+
})
|
|
766
|
+
);
|
|
767
|
+
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
describe('cancel events', function() {
|
|
772
|
+
|
|
773
|
+
var diagramXML = require('../../../fixtures/bpmn/features/replace/cancel-events.bpmn');
|
|
774
|
+
|
|
775
|
+
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
776
|
+
|
|
777
|
+
it('should contain cancel event replace option',
|
|
778
|
+
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
|
779
|
+
|
|
780
|
+
// given
|
|
781
|
+
var endEvent = elementRegistry.get('EndEvent_1');
|
|
782
|
+
|
|
783
|
+
// when
|
|
784
|
+
openPopup(endEvent);
|
|
785
|
+
|
|
786
|
+
// then
|
|
787
|
+
expect(getEntries(popupMenu)).to.have.length(9);
|
|
788
|
+
})
|
|
789
|
+
);
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
it('should NOT contain cancel event replace option',
|
|
793
|
+
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
|
794
|
+
|
|
795
|
+
// given
|
|
796
|
+
var endEvent = elementRegistry.get('EndEvent_2');
|
|
797
|
+
|
|
798
|
+
// when
|
|
799
|
+
openPopup(endEvent);
|
|
800
|
+
|
|
801
|
+
// then
|
|
802
|
+
expect(getEntries(popupMenu)).to.have.length(8);
|
|
803
|
+
})
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
it('should contain cancel event replace option (boundary events)',
|
|
808
|
+
inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
809
|
+
|
|
810
|
+
// given
|
|
811
|
+
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
812
|
+
|
|
813
|
+
// when
|
|
814
|
+
openPopup(boundaryEvent);
|
|
815
|
+
|
|
816
|
+
// then
|
|
817
|
+
expect(getEntries(popupMenu)).to.have.length(13);
|
|
818
|
+
})
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
it('should NOT contain cancel event replace option (boundary events)',
|
|
823
|
+
inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
824
|
+
|
|
825
|
+
// given
|
|
826
|
+
var boundaryEvent = elementRegistry.get('BoundaryEvent_2');
|
|
827
|
+
|
|
828
|
+
// when
|
|
829
|
+
openPopup(boundaryEvent, 40);
|
|
830
|
+
|
|
831
|
+
// then
|
|
832
|
+
expect(getEntries(popupMenu)).to.have.length(13);
|
|
833
|
+
})
|
|
834
|
+
);
|
|
835
|
+
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
describe('boundary events', function() {
|
|
840
|
+
|
|
841
|
+
beforeEach(bootstrapModeler(diagramXMLReplace, { modules: testModules }));
|
|
842
|
+
|
|
843
|
+
it('should contain all boundary events for an interrupting boundary event',
|
|
844
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
845
|
+
|
|
846
|
+
// given
|
|
847
|
+
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
848
|
+
|
|
849
|
+
// when
|
|
850
|
+
openPopup(boundaryEvent, 40);
|
|
851
|
+
|
|
852
|
+
// then
|
|
853
|
+
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
|
854
|
+
expect(getEntries(popupMenu)).to.have.length(12);
|
|
855
|
+
})
|
|
856
|
+
);
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
it('should contain all boundary events for a non interrupting boundary event',
|
|
860
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
861
|
+
|
|
862
|
+
// given
|
|
863
|
+
var boundaryEvent = elementRegistry.get('BoundaryEvent_2');
|
|
864
|
+
|
|
865
|
+
// when
|
|
866
|
+
openPopup(boundaryEvent, 40);
|
|
867
|
+
|
|
868
|
+
// then
|
|
869
|
+
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
|
870
|
+
expect(getEntries(popupMenu)).to.have.length(12);
|
|
871
|
+
})
|
|
872
|
+
);
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
it('should contain compensation boundary event',
|
|
876
|
+
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
|
877
|
+
|
|
878
|
+
// given
|
|
879
|
+
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
|
880
|
+
|
|
881
|
+
// when
|
|
882
|
+
openPopup(boundaryEvent, 40);
|
|
883
|
+
|
|
884
|
+
// then
|
|
885
|
+
expect(queryEntry(popupMenu, 'replace-with-compensation-boundary')).to.exist;
|
|
886
|
+
})
|
|
887
|
+
);
|
|
888
|
+
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
describe('default flows', function() {
|
|
893
|
+
|
|
894
|
+
var diagramXML = require('./ReplaceMenuProvider.defaultFlows.bpmn');
|
|
895
|
+
|
|
896
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
897
|
+
modules: testModules
|
|
898
|
+
}));
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
it('should show default replace option [gateway]', inject(function(elementRegistry, popupMenu) {
|
|
902
|
+
// given
|
|
903
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
904
|
+
|
|
905
|
+
// when
|
|
906
|
+
openPopup(sequenceFlow);
|
|
907
|
+
|
|
908
|
+
// then
|
|
909
|
+
expect(getEntries(popupMenu)).to.have.length(1);
|
|
910
|
+
}));
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
it('should show Default replace option [task]', inject(function(elementRegistry, popupMenu) {
|
|
914
|
+
// given
|
|
915
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
916
|
+
|
|
917
|
+
// when
|
|
918
|
+
openPopup(sequenceFlow);
|
|
919
|
+
|
|
920
|
+
// then
|
|
921
|
+
expect(getEntries(popupMenu)).to.have.length(2);
|
|
922
|
+
}));
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
926
|
+
// given
|
|
927
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_4');
|
|
928
|
+
|
|
929
|
+
// when
|
|
930
|
+
openPopup(sequenceFlow);
|
|
931
|
+
|
|
932
|
+
// then
|
|
933
|
+
expect(getEntries(popupMenu)).to.have.length(0);
|
|
934
|
+
}));
|
|
935
|
+
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
describe('default flows from inclusive gateways', function() {
|
|
940
|
+
|
|
941
|
+
var diagramXML = require('./ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn');
|
|
942
|
+
|
|
943
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
944
|
+
modules: testModules
|
|
945
|
+
}));
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
949
|
+
// given
|
|
950
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
951
|
+
|
|
952
|
+
// when
|
|
953
|
+
openPopup(sequenceFlow);
|
|
954
|
+
|
|
955
|
+
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
956
|
+
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
957
|
+
|
|
958
|
+
// then
|
|
959
|
+
expect(sequenceFlowEntry).to.not.exist;
|
|
960
|
+
expect(defaultFlowEntry).to.exist;
|
|
961
|
+
}));
|
|
962
|
+
|
|
963
|
+
|
|
964
|
+
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
965
|
+
// given
|
|
966
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
967
|
+
|
|
968
|
+
// when
|
|
969
|
+
openPopup(sequenceFlow);
|
|
970
|
+
|
|
971
|
+
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
972
|
+
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
973
|
+
|
|
974
|
+
// then
|
|
975
|
+
expect(sequenceFlowEntry).to.exist;
|
|
976
|
+
expect(defaultFlowEntry).to.not.exist;
|
|
977
|
+
}));
|
|
978
|
+
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
describe('default flows from complex gateways', function() {
|
|
983
|
+
|
|
984
|
+
var diagramXML = require('./ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn');
|
|
985
|
+
|
|
986
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
987
|
+
modules: testModules
|
|
988
|
+
}));
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
992
|
+
// given
|
|
993
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
994
|
+
|
|
995
|
+
// when
|
|
996
|
+
openPopup(sequenceFlow);
|
|
997
|
+
|
|
998
|
+
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
999
|
+
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
1000
|
+
|
|
1001
|
+
// then
|
|
1002
|
+
expect(sequenceFlowEntry).to.not.exist;
|
|
1003
|
+
expect(defaultFlowEntry).to.exist;
|
|
1004
|
+
}));
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
|
1008
|
+
// given
|
|
1009
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
1010
|
+
|
|
1011
|
+
// when
|
|
1012
|
+
openPopup(sequenceFlow);
|
|
1013
|
+
|
|
1014
|
+
var sequenceFlowEntry = queryEntry(popupMenu, 'replace-with-sequence-flow'),
|
|
1015
|
+
defaultFlowEntry = queryEntry(popupMenu, 'replace-with-default-flow');
|
|
1016
|
+
|
|
1017
|
+
// then
|
|
1018
|
+
expect(sequenceFlowEntry).to.exist;
|
|
1019
|
+
expect(defaultFlowEntry).to.not.exist;
|
|
1020
|
+
}));
|
|
1021
|
+
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
describe('conditional flows', function() {
|
|
1026
|
+
|
|
1027
|
+
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
|
1028
|
+
|
|
1029
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
1030
|
+
modules: testModules
|
|
1031
|
+
}));
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
it('should show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
|
1035
|
+
// given
|
|
1036
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
1037
|
+
|
|
1038
|
+
// when
|
|
1039
|
+
openPopup(sequenceFlow);
|
|
1040
|
+
|
|
1041
|
+
var conditionalFlowEntry = queryEntry(popupMenu, 'replace-with-conditional-flow');
|
|
1042
|
+
|
|
1043
|
+
// then
|
|
1044
|
+
expect(conditionalFlowEntry).to.exist;
|
|
1045
|
+
|
|
1046
|
+
expect(getEntries(popupMenu)).to.have.length(2);
|
|
1047
|
+
}));
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
it('should NOT show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
|
1051
|
+
// given
|
|
1052
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
|
1053
|
+
|
|
1054
|
+
// when
|
|
1055
|
+
openPopup(sequenceFlow);
|
|
1056
|
+
|
|
1057
|
+
// then
|
|
1058
|
+
expect(getEntries(popupMenu)).to.have.length(0);
|
|
1059
|
+
}));
|
|
1060
|
+
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
describe('compensate activities', function() {
|
|
1065
|
+
|
|
1066
|
+
var diagramXML = require('./ReplaceMenuProvider.compensation-activity.bpmn');
|
|
1067
|
+
|
|
1068
|
+
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
it('options should include subProcesses and callActivity', inject(function(elementRegistry, popupMenu) {
|
|
1072
|
+
|
|
1073
|
+
// given
|
|
1074
|
+
var taskElement = elementRegistry.get('Task_1');
|
|
1075
|
+
|
|
1076
|
+
// when
|
|
1077
|
+
openPopup(taskElement);
|
|
1078
|
+
|
|
1079
|
+
var callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
|
|
1080
|
+
subProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess');
|
|
1081
|
+
|
|
1082
|
+
// then
|
|
1083
|
+
expect(callActivityEntry).to.exist;
|
|
1084
|
+
expect(subProcessEntry).to.exist;
|
|
1085
|
+
}));
|
|
1086
|
+
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
describe('collapsed subprocesses', function() {
|
|
1090
|
+
|
|
1091
|
+
var diagramXML = require('./ReplaceMenuProvider.collapsedSubProcess.bpmn');
|
|
1092
|
+
|
|
1093
|
+
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
it('options do not include collapsed subprocesses itself', inject(function(elementRegistry, popupMenu) {
|
|
1097
|
+
|
|
1098
|
+
// given
|
|
1099
|
+
var collapsedSubProcess = elementRegistry.get('Task_1');
|
|
1100
|
+
|
|
1101
|
+
// when
|
|
1102
|
+
openPopup(collapsedSubProcess);
|
|
1103
|
+
|
|
1104
|
+
var collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess');
|
|
1105
|
+
|
|
1106
|
+
// then
|
|
1107
|
+
expect(collapsedSubProcessEntry).to.not.exist;
|
|
1108
|
+
}));
|
|
1109
|
+
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
describe('integration', function() {
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
describe('default flows', function() {
|
|
1120
|
+
|
|
1121
|
+
var diagramXML = require('./ReplaceMenuProvider.defaultFlows.bpmn');
|
|
1122
|
+
|
|
1123
|
+
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
it('should replace SequenceFlow with DefaultFlow [gateway]', inject(function(elementRegistry, popupMenu) {
|
|
1127
|
+
// given
|
|
1128
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
|
1129
|
+
|
|
1130
|
+
//when
|
|
1131
|
+
openPopup(sequenceFlow);
|
|
1132
|
+
|
|
1133
|
+
var entries = getEntries(popupMenu);
|
|
1134
|
+
|
|
1135
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1136
|
+
|
|
1137
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1138
|
+
|
|
1139
|
+
// then
|
|
1140
|
+
expect(gateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1141
|
+
}));
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
it('should replace SequenceFlow with DefaultFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1145
|
+
// given
|
|
1146
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
1147
|
+
|
|
1148
|
+
// when
|
|
1149
|
+
openPopup(sequenceFlow);
|
|
1150
|
+
|
|
1151
|
+
var entries = getEntries(popupMenu);
|
|
1152
|
+
|
|
1153
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1154
|
+
|
|
1155
|
+
var task = elementRegistry.get('Task_1ei94kl');
|
|
1156
|
+
|
|
1157
|
+
// then
|
|
1158
|
+
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1159
|
+
}));
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
it('should morph DefaultFlow into a SequenceFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1163
|
+
// given
|
|
1164
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1165
|
+
entries;
|
|
1166
|
+
|
|
1167
|
+
openPopup(sequenceFlow);
|
|
1168
|
+
|
|
1169
|
+
entries = getEntries(popupMenu);
|
|
1170
|
+
|
|
1171
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1172
|
+
|
|
1173
|
+
// when
|
|
1174
|
+
openPopup(sequenceFlow);
|
|
1175
|
+
|
|
1176
|
+
entries = getEntries(popupMenu);
|
|
1177
|
+
|
|
1178
|
+
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1179
|
+
|
|
1180
|
+
var task = elementRegistry.get('Task_1ei94kl');
|
|
1181
|
+
|
|
1182
|
+
// then
|
|
1183
|
+
expect(task.businessObject.default).to.not.exist;
|
|
1184
|
+
}));
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
it('should morph DefaultFlow into a SequenceFlow [task] -> undo',
|
|
1188
|
+
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1189
|
+
|
|
1190
|
+
// given
|
|
1191
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1192
|
+
entries;
|
|
1193
|
+
|
|
1194
|
+
openPopup(sequenceFlow);
|
|
1195
|
+
|
|
1196
|
+
entries = getEntries(popupMenu);
|
|
1197
|
+
|
|
1198
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1199
|
+
|
|
1200
|
+
// when
|
|
1201
|
+
openPopup(sequenceFlow);
|
|
1202
|
+
|
|
1203
|
+
entries = getEntries(popupMenu);
|
|
1204
|
+
|
|
1205
|
+
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1206
|
+
|
|
1207
|
+
commandStack.undo();
|
|
1208
|
+
|
|
1209
|
+
var task = elementRegistry.get('Task_1ei94kl');
|
|
1210
|
+
|
|
1211
|
+
// then
|
|
1212
|
+
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1213
|
+
})
|
|
1214
|
+
);
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
it('should morph DefaultFlow into a ConditionalFlow [task]', inject(function(elementRegistry, popupMenu) {
|
|
1218
|
+
// given
|
|
1219
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1220
|
+
task = elementRegistry.get('Task_1ei94kl'),
|
|
1221
|
+
entries;
|
|
1222
|
+
|
|
1223
|
+
openPopup(sequenceFlow);
|
|
1224
|
+
|
|
1225
|
+
entries = getEntries(popupMenu);
|
|
1226
|
+
|
|
1227
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1228
|
+
|
|
1229
|
+
// when
|
|
1230
|
+
openPopup(sequenceFlow);
|
|
1231
|
+
|
|
1232
|
+
entries = getEntries(popupMenu);
|
|
1233
|
+
|
|
1234
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1235
|
+
|
|
1236
|
+
// then
|
|
1237
|
+
expect(task.businessObject.default).to.not.exist;
|
|
1238
|
+
}));
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
it('should morph DefaultFlow into a ConditionalFlow [task] -> undo',
|
|
1242
|
+
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1243
|
+
|
|
1244
|
+
// given
|
|
1245
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1246
|
+
task = elementRegistry.get('Task_1ei94kl'),
|
|
1247
|
+
entries;
|
|
1248
|
+
|
|
1249
|
+
openPopup(sequenceFlow);
|
|
1250
|
+
|
|
1251
|
+
entries = getEntries(popupMenu);
|
|
1252
|
+
|
|
1253
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1254
|
+
|
|
1255
|
+
// when
|
|
1256
|
+
openPopup(sequenceFlow);
|
|
1257
|
+
|
|
1258
|
+
entries = getEntries(popupMenu);
|
|
1259
|
+
|
|
1260
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1261
|
+
|
|
1262
|
+
commandStack.undo();
|
|
1263
|
+
|
|
1264
|
+
// then
|
|
1265
|
+
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1266
|
+
})
|
|
1267
|
+
);
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
it('should replace SequenceFlow with DefaultFlow [gateway] -> undo',
|
|
1271
|
+
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1272
|
+
|
|
1273
|
+
// given
|
|
1274
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1275
|
+
gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1276
|
+
|
|
1277
|
+
// when
|
|
1278
|
+
openPopup(sequenceFlow);
|
|
1279
|
+
|
|
1280
|
+
var entries = getEntries(popupMenu);
|
|
1281
|
+
|
|
1282
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1283
|
+
|
|
1284
|
+
commandStack.undo();
|
|
1285
|
+
|
|
1286
|
+
// then
|
|
1287
|
+
expect(gateway.businessObject.default).to.not.exist;
|
|
1288
|
+
})
|
|
1289
|
+
);
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
it('should replace SequenceFlow with DefaultFlow [task] -> undo',
|
|
1293
|
+
inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1294
|
+
|
|
1295
|
+
// given
|
|
1296
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
|
1297
|
+
|
|
1298
|
+
// when
|
|
1299
|
+
openPopup(sequenceFlow);
|
|
1300
|
+
|
|
1301
|
+
var entries = getEntries(popupMenu);
|
|
1302
|
+
|
|
1303
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1304
|
+
|
|
1305
|
+
commandStack.undo();
|
|
1306
|
+
|
|
1307
|
+
var task = elementRegistry.get('Task_1ei94kl');
|
|
1308
|
+
|
|
1309
|
+
// then
|
|
1310
|
+
expect(task.businessObject.default).to.not.exist;
|
|
1311
|
+
})
|
|
1312
|
+
);
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
it('should only have one DefaultFlow', inject(function(elementRegistry, popupMenu) {
|
|
1316
|
+
// given
|
|
1317
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1318
|
+
sequenceFlow3 = elementRegistry.get('SequenceFlow_3');
|
|
1319
|
+
|
|
1320
|
+
var entries;
|
|
1321
|
+
|
|
1322
|
+
// when
|
|
1323
|
+
// trigger morphing sequenceFlow3 to default flow
|
|
1324
|
+
openPopup(sequenceFlow3);
|
|
1325
|
+
|
|
1326
|
+
entries = getEntries(popupMenu);
|
|
1327
|
+
|
|
1328
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1329
|
+
|
|
1330
|
+
// trigger morphing sequenceFlow to default flow
|
|
1331
|
+
openPopup(sequenceFlow);
|
|
1332
|
+
|
|
1333
|
+
entries = getEntries(popupMenu);
|
|
1334
|
+
|
|
1335
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1336
|
+
|
|
1337
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1338
|
+
|
|
1339
|
+
// then
|
|
1340
|
+
expect(gateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1341
|
+
}));
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
it('should replace DefaultFlow with SequenceFlow when changing source',
|
|
1345
|
+
inject(function(elementRegistry, popupMenu, modeling) {
|
|
1346
|
+
|
|
1347
|
+
// given
|
|
1348
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1349
|
+
task = elementRegistry.get('Task_2');
|
|
1350
|
+
|
|
1351
|
+
openPopup(sequenceFlow);
|
|
1352
|
+
|
|
1353
|
+
var entries = getEntries(popupMenu);
|
|
1354
|
+
|
|
1355
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1356
|
+
|
|
1357
|
+
// when
|
|
1358
|
+
modeling.reconnectStart(sequenceFlow, task, [
|
|
1359
|
+
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1360
|
+
{ x: 686, y: 207, original: { x: 686, y: 187 } }
|
|
1361
|
+
]);
|
|
1362
|
+
|
|
1363
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1364
|
+
|
|
1365
|
+
// then
|
|
1366
|
+
expect(gateway.businessObject.default).to.not.exist;
|
|
1367
|
+
})
|
|
1368
|
+
);
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
it('should replace DefaultFlow with SequenceFlow when changing source -> undo',
|
|
1372
|
+
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
|
1373
|
+
|
|
1374
|
+
// given
|
|
1375
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1376
|
+
task = elementRegistry.get('Task_2');
|
|
1377
|
+
|
|
1378
|
+
openPopup(sequenceFlow);
|
|
1379
|
+
|
|
1380
|
+
var entries = getEntries(popupMenu);
|
|
1381
|
+
|
|
1382
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1383
|
+
|
|
1384
|
+
// when
|
|
1385
|
+
modeling.reconnectStart(sequenceFlow, task, [
|
|
1386
|
+
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1387
|
+
{ x: 686, y: 207, original: { x: 686, y: 187 } }
|
|
1388
|
+
]);
|
|
1389
|
+
|
|
1390
|
+
commandStack.undo();
|
|
1391
|
+
|
|
1392
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1393
|
+
|
|
1394
|
+
// then
|
|
1395
|
+
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
|
1396
|
+
})
|
|
1397
|
+
);
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
[
|
|
1401
|
+
'bpmn:StartEvent'
|
|
1402
|
+
].forEach(function(type) {
|
|
1403
|
+
|
|
1404
|
+
it('should replace DefaultFlow with SequenceFlow when changing target to ' + type,
|
|
1405
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1406
|
+
|
|
1407
|
+
// given
|
|
1408
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1409
|
+
root = canvas.getRootElement();
|
|
1410
|
+
|
|
1411
|
+
var intermediateEvent = elementFactory.createShape({ type: type });
|
|
1412
|
+
|
|
1413
|
+
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
|
1414
|
+
|
|
1415
|
+
openPopup(sequenceFlow);
|
|
1416
|
+
|
|
1417
|
+
var entries = getEntries(popupMenu);
|
|
1418
|
+
|
|
1419
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1420
|
+
|
|
1421
|
+
// when
|
|
1422
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1423
|
+
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1424
|
+
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1425
|
+
]);
|
|
1426
|
+
|
|
1427
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1428
|
+
|
|
1429
|
+
// then
|
|
1430
|
+
expect(gateway.businessObject.default).to.not.exist;
|
|
1431
|
+
})
|
|
1432
|
+
);
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
[
|
|
1437
|
+
'bpmn:Activity',
|
|
1438
|
+
'bpmn:EndEvent',
|
|
1439
|
+
'bpmn:IntermediateThrowEvent'
|
|
1440
|
+
].forEach(function(type) {
|
|
1441
|
+
|
|
1442
|
+
it('should keep DefaultFlow when changing target to ' + type,
|
|
1443
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1444
|
+
|
|
1445
|
+
// given
|
|
1446
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1447
|
+
root = canvas.getRootElement();
|
|
1448
|
+
|
|
1449
|
+
var intermediateEvent = elementFactory.createShape({ type: type });
|
|
1450
|
+
|
|
1451
|
+
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
|
1452
|
+
|
|
1453
|
+
openPopup(sequenceFlow);
|
|
1454
|
+
|
|
1455
|
+
var entries = getEntries(popupMenu);
|
|
1456
|
+
|
|
1457
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1458
|
+
|
|
1459
|
+
// when
|
|
1460
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1461
|
+
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1462
|
+
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1463
|
+
]);
|
|
1464
|
+
|
|
1465
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1466
|
+
|
|
1467
|
+
// then
|
|
1468
|
+
expect(gateway.businessObject.default).to.exist;
|
|
1469
|
+
})
|
|
1470
|
+
);
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
|
|
1474
|
+
it('should replace DefaultFlow with SequenceFlow when changing target -> undo',
|
|
1475
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
|
1476
|
+
|
|
1477
|
+
// given
|
|
1478
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
|
1479
|
+
rootElement = canvas.getRootElement();
|
|
1480
|
+
|
|
1481
|
+
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
|
1482
|
+
|
|
1483
|
+
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, rootElement);
|
|
1484
|
+
|
|
1485
|
+
openPopup(sequenceFlow);
|
|
1486
|
+
|
|
1487
|
+
var entries = getEntries(popupMenu);
|
|
1488
|
+
|
|
1489
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1490
|
+
|
|
1491
|
+
// when
|
|
1492
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1493
|
+
{ x: 686, y: 267, original: { x: 686, y: 307 } },
|
|
1494
|
+
{ x: 686, y: 50, original: { x: 686, y: 75 } }
|
|
1495
|
+
]);
|
|
1496
|
+
|
|
1497
|
+
commandStack.undo();
|
|
1498
|
+
|
|
1499
|
+
var gateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1500
|
+
|
|
1501
|
+
// then
|
|
1502
|
+
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
|
1503
|
+
})
|
|
1504
|
+
);
|
|
1505
|
+
|
|
1506
|
+
|
|
1507
|
+
it('should keep DefaultFlow when morphing Gateway', inject(function(elementRegistry, popupMenu, bpmnReplace) {
|
|
1508
|
+
// given
|
|
1509
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1510
|
+
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1511
|
+
|
|
1512
|
+
// when
|
|
1513
|
+
openPopup(sequenceFlow);
|
|
1514
|
+
|
|
1515
|
+
var entries = getEntries(popupMenu);
|
|
1516
|
+
|
|
1517
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1518
|
+
|
|
1519
|
+
var inclusiveGateway = bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
|
1520
|
+
|
|
1521
|
+
// then
|
|
1522
|
+
expect(inclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1523
|
+
}));
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
it('should keep DefaultFlow when morphing Task', inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
|
1527
|
+
// given
|
|
1528
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
|
1529
|
+
task = elementRegistry.get('Task_1ei94kl');
|
|
1530
|
+
|
|
1531
|
+
// when
|
|
1532
|
+
openPopup(sequenceFlow);
|
|
1533
|
+
|
|
1534
|
+
var entries = getEntries(popupMenu);
|
|
1535
|
+
|
|
1536
|
+
// trigger DefaultFlow replacement
|
|
1537
|
+
var replaceDefaultFlow = find(entries, { id: 'replace-with-default-flow' });
|
|
1538
|
+
|
|
1539
|
+
replaceDefaultFlow.action();
|
|
1540
|
+
|
|
1541
|
+
var sendTask = bpmnReplace.replaceElement(task, { type: 'bpmn:SendTask' });
|
|
1542
|
+
|
|
1543
|
+
// then
|
|
1544
|
+
expect(sendTask.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1545
|
+
}));
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
it('should keep DefaultFlow when morphing Gateway -> undo',
|
|
1549
|
+
inject(function(elementRegistry, bpmnReplace, popupMenu, commandStack) {
|
|
1550
|
+
|
|
1551
|
+
// given
|
|
1552
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1553
|
+
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1554
|
+
|
|
1555
|
+
// when
|
|
1556
|
+
openPopup(sequenceFlow);
|
|
1557
|
+
|
|
1558
|
+
var entries = getEntries(popupMenu);
|
|
1559
|
+
|
|
1560
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1561
|
+
|
|
1562
|
+
bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
|
1563
|
+
|
|
1564
|
+
commandStack.undo();
|
|
1565
|
+
|
|
1566
|
+
// then
|
|
1567
|
+
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1568
|
+
})
|
|
1569
|
+
);
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
it('should remove any conditionExpression when morphing to DefaultFlow',
|
|
1573
|
+
inject(function(elementRegistry, modeling, popupMenu, moddle) {
|
|
1574
|
+
|
|
1575
|
+
// given
|
|
1576
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1577
|
+
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1578
|
+
|
|
1579
|
+
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
|
1580
|
+
|
|
1581
|
+
modeling.updateProperties(sequenceFlow, { conditionExpression: conditionExpression });
|
|
1582
|
+
|
|
1583
|
+
// when
|
|
1584
|
+
openPopup(sequenceFlow);
|
|
1585
|
+
|
|
1586
|
+
var entries = getEntries(popupMenu);
|
|
1587
|
+
|
|
1588
|
+
// trigger DefaultFlow replacement
|
|
1589
|
+
triggerAction(entries, 'replace-with-default-flow');
|
|
1590
|
+
|
|
1591
|
+
// then
|
|
1592
|
+
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
|
1593
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1594
|
+
})
|
|
1595
|
+
);
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
it('should remove any conditionExpression when morphing to DefaultFlow -> undo',
|
|
1599
|
+
inject(function(elementRegistry, modeling, popupMenu, moddle, commandStack) {
|
|
1600
|
+
|
|
1601
|
+
// given
|
|
1602
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1603
|
+
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
|
1604
|
+
|
|
1605
|
+
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
|
1606
|
+
|
|
1607
|
+
modeling.updateProperties(sequenceFlow, { conditionExpression: conditionExpression });
|
|
1608
|
+
|
|
1609
|
+
// when
|
|
1610
|
+
openPopup(sequenceFlow);
|
|
1611
|
+
|
|
1612
|
+
var entries = getEntries(popupMenu);
|
|
1613
|
+
|
|
1614
|
+
// trigger DefaultFlow replacement
|
|
1615
|
+
entries[0].action();
|
|
1616
|
+
|
|
1617
|
+
commandStack.undo();
|
|
1618
|
+
|
|
1619
|
+
// then
|
|
1620
|
+
expect(exclusiveGateway.businessObject.default).to.not.exist;
|
|
1621
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.equal(conditionExpression);
|
|
1622
|
+
})
|
|
1623
|
+
);
|
|
1624
|
+
|
|
1625
|
+
});
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
describe('conditional flows', function() {
|
|
1629
|
+
|
|
1630
|
+
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
|
1631
|
+
|
|
1632
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
1633
|
+
modules: testModules
|
|
1634
|
+
}));
|
|
1635
|
+
|
|
1636
|
+
|
|
1637
|
+
it('should morph into a ConditionalFlow', inject(function(elementRegistry, popupMenu) {
|
|
1638
|
+
// given
|
|
1639
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1640
|
+
|
|
1641
|
+
// when
|
|
1642
|
+
openPopup(sequenceFlow);
|
|
1643
|
+
|
|
1644
|
+
var entries = getEntries(popupMenu);
|
|
1645
|
+
|
|
1646
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1647
|
+
|
|
1648
|
+
// then
|
|
1649
|
+
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1650
|
+
}));
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
it('should morph into a ConditionalFlow -> undo', inject(function(elementRegistry, popupMenu, commandStack) {
|
|
1654
|
+
// given
|
|
1655
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1656
|
+
|
|
1657
|
+
// when
|
|
1658
|
+
openPopup(sequenceFlow);
|
|
1659
|
+
|
|
1660
|
+
var entries = getEntries(popupMenu);
|
|
1661
|
+
|
|
1662
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1663
|
+
|
|
1664
|
+
commandStack.undo();
|
|
1665
|
+
|
|
1666
|
+
// then
|
|
1667
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1668
|
+
}));
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
it('should morph back into a SequenceFlow', inject(function(elementRegistry, popupMenu) {
|
|
1672
|
+
// given
|
|
1673
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
|
1674
|
+
|
|
1675
|
+
// when
|
|
1676
|
+
openPopup(sequenceFlow);
|
|
1677
|
+
|
|
1678
|
+
var entries = getEntries(popupMenu);
|
|
1679
|
+
|
|
1680
|
+
// trigger ConditionalFlow replacement
|
|
1681
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1682
|
+
|
|
1683
|
+
openPopup(sequenceFlow);
|
|
1684
|
+
|
|
1685
|
+
entries = getEntries(popupMenu);
|
|
1686
|
+
|
|
1687
|
+
// replace with SequenceFlow
|
|
1688
|
+
triggerAction(entries, 'replace-with-sequence-flow');
|
|
1689
|
+
|
|
1690
|
+
// then
|
|
1691
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1692
|
+
}));
|
|
1693
|
+
|
|
1694
|
+
|
|
1695
|
+
it('should replace ConditionalFlow with SequenceFlow when changing source',
|
|
1696
|
+
inject(function(elementRegistry, popupMenu, modeling) {
|
|
1697
|
+
|
|
1698
|
+
// given
|
|
1699
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1700
|
+
startEvent = elementRegistry.get('StartEvent_1');
|
|
1701
|
+
|
|
1702
|
+
// when
|
|
1703
|
+
openPopup(sequenceFlow);
|
|
1704
|
+
|
|
1705
|
+
var entries = getEntries(popupMenu);
|
|
1706
|
+
|
|
1707
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1708
|
+
|
|
1709
|
+
// when
|
|
1710
|
+
modeling.reconnectStart(sequenceFlow, startEvent, [
|
|
1711
|
+
{ x: 196, y: 197, original: { x: 178, y: 197 } },
|
|
1712
|
+
{ x: 497, y: 278, original: { x: 547, y: 278 } }
|
|
1713
|
+
]);
|
|
1714
|
+
|
|
1715
|
+
// then
|
|
1716
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1717
|
+
})
|
|
1718
|
+
);
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
it('should replace ConditionalFlow with SequenceFlow when changing source -> undo',
|
|
1722
|
+
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
|
1723
|
+
|
|
1724
|
+
// given
|
|
1725
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1726
|
+
startEvent = elementRegistry.get('StartEvent_1');
|
|
1727
|
+
|
|
1728
|
+
// when
|
|
1729
|
+
openPopup(sequenceFlow);
|
|
1730
|
+
|
|
1731
|
+
var entries = getEntries(popupMenu);
|
|
1732
|
+
|
|
1733
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1734
|
+
|
|
1735
|
+
// when
|
|
1736
|
+
modeling.reconnectStart(sequenceFlow, startEvent, [
|
|
1737
|
+
{ x: 196, y: 197, original: { x: 178, y: 197 } },
|
|
1738
|
+
{ x: 497, y: 278, original: { x: 547, y: 278 } }
|
|
1739
|
+
]);
|
|
1740
|
+
|
|
1741
|
+
commandStack.undo();
|
|
1742
|
+
|
|
1743
|
+
// then
|
|
1744
|
+
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1745
|
+
})
|
|
1746
|
+
);
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
[
|
|
1750
|
+
'bpmn:StartEvent'
|
|
1751
|
+
].forEach(function(type) {
|
|
1752
|
+
|
|
1753
|
+
it('should replace ConditionalFlow with SequenceFlow when changing target to ' + type,
|
|
1754
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1755
|
+
|
|
1756
|
+
// given
|
|
1757
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1758
|
+
root = canvas.getRootElement(),
|
|
1759
|
+
intermediateEvent = elementFactory.createShape({ type: type });
|
|
1760
|
+
|
|
1761
|
+
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1762
|
+
|
|
1763
|
+
openPopup(sequenceFlow);
|
|
1764
|
+
|
|
1765
|
+
var entries = getEntries(popupMenu);
|
|
1766
|
+
|
|
1767
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1768
|
+
|
|
1769
|
+
// when
|
|
1770
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1771
|
+
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1772
|
+
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1773
|
+
]);
|
|
1774
|
+
|
|
1775
|
+
// then
|
|
1776
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
|
1777
|
+
})
|
|
1778
|
+
);
|
|
1779
|
+
|
|
1780
|
+
});
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
[
|
|
1784
|
+
'bpmn:Activity',
|
|
1785
|
+
'bpmn:EndEvent',
|
|
1786
|
+
'bpmn:IntermediateThrowEvent'
|
|
1787
|
+
].forEach(function(type) {
|
|
1788
|
+
|
|
1789
|
+
it('should keep ConditionalFlow when changing target to ' + type,
|
|
1790
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
|
1791
|
+
|
|
1792
|
+
// given
|
|
1793
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1794
|
+
root = canvas.getRootElement(),
|
|
1795
|
+
intermediateEvent = elementFactory.createShape({ type: type });
|
|
1796
|
+
|
|
1797
|
+
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1798
|
+
|
|
1799
|
+
openPopup(sequenceFlow);
|
|
1800
|
+
|
|
1801
|
+
var entries = getEntries(popupMenu);
|
|
1802
|
+
|
|
1803
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1804
|
+
|
|
1805
|
+
// when
|
|
1806
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1807
|
+
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1808
|
+
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1809
|
+
]);
|
|
1810
|
+
|
|
1811
|
+
// then
|
|
1812
|
+
expect(sequenceFlow.businessObject.conditionExpression).to.exist;
|
|
1813
|
+
})
|
|
1814
|
+
);
|
|
1815
|
+
|
|
1816
|
+
});
|
|
1817
|
+
|
|
1818
|
+
|
|
1819
|
+
it('should replace ConditionalFlow with SequenceFlow when changing target -> undo',
|
|
1820
|
+
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
|
1821
|
+
|
|
1822
|
+
// given
|
|
1823
|
+
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
|
1824
|
+
root = canvas.getRootElement(),
|
|
1825
|
+
intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
|
1826
|
+
|
|
1827
|
+
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
|
1828
|
+
|
|
1829
|
+
openPopup(sequenceFlow);
|
|
1830
|
+
|
|
1831
|
+
var entries = getEntries(popupMenu);
|
|
1832
|
+
|
|
1833
|
+
// trigger ConditionalFlow replacement
|
|
1834
|
+
triggerAction(entries, 'replace-with-conditional-flow');
|
|
1835
|
+
|
|
1836
|
+
// when
|
|
1837
|
+
modeling.reconnectEnd(sequenceFlow, intermediateEvent, [
|
|
1838
|
+
{ x: 389, y: 197, original: { x: 389, y: 197 } },
|
|
1839
|
+
{ x: 497, y: 197, original: { x: 497, y: 197 } }
|
|
1840
|
+
]);
|
|
1841
|
+
|
|
1842
|
+
commandStack.undo();
|
|
1843
|
+
|
|
1844
|
+
// then
|
|
1845
|
+
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
|
1846
|
+
})
|
|
1847
|
+
);
|
|
1848
|
+
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
});
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
describe('rules', function() {
|
|
1855
|
+
|
|
1856
|
+
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
|
|
1857
|
+
|
|
1858
|
+
beforeEach(bootstrapModeler(diagramXML, {
|
|
1859
|
+
modules: testModules.concat([ customRulesModule ])
|
|
1860
|
+
}));
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
it('should get entries by default', inject(function(elementRegistry, popupMenu) {
|
|
1864
|
+
|
|
1865
|
+
// given
|
|
1866
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1867
|
+
|
|
1868
|
+
// when
|
|
1869
|
+
openPopup(startEvent);
|
|
1870
|
+
|
|
1871
|
+
var entries = getEntries(popupMenu);
|
|
1872
|
+
|
|
1873
|
+
// then
|
|
1874
|
+
expect(entries).to.have.length.above(0);
|
|
1875
|
+
}));
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
it('should get entries when custom rule returns true',
|
|
1879
|
+
inject(function(elementRegistry, popupMenu, customRules) {
|
|
1880
|
+
|
|
1881
|
+
// given
|
|
1882
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1883
|
+
|
|
1884
|
+
customRules.addRule('shape.replace', function() {
|
|
1885
|
+
return true;
|
|
1886
|
+
});
|
|
1887
|
+
|
|
1888
|
+
//when
|
|
1889
|
+
openPopup(startEvent);
|
|
1890
|
+
|
|
1891
|
+
var entries = getEntries(popupMenu);
|
|
1892
|
+
|
|
1893
|
+
// then
|
|
1894
|
+
expect(entries).to.have.length.above(0);
|
|
1895
|
+
})
|
|
1896
|
+
);
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
it('should get no entries when custom rule returns false',
|
|
1900
|
+
inject(function(elementRegistry, popupMenu, customRules) {
|
|
1901
|
+
|
|
1902
|
+
// given
|
|
1903
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1904
|
+
|
|
1905
|
+
customRules.addRule('shape.replace', function() {
|
|
1906
|
+
return false;
|
|
1907
|
+
});
|
|
1908
|
+
|
|
1909
|
+
// when
|
|
1910
|
+
openPopup(startEvent);
|
|
1911
|
+
|
|
1912
|
+
var entries = getEntries(popupMenu);
|
|
1913
|
+
|
|
1914
|
+
// then
|
|
1915
|
+
expect(entries).to.have.length(0);
|
|
1916
|
+
})
|
|
1917
|
+
);
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
it('should provide element to custom rules', inject(function(elementRegistry, popupMenu, customRules) {
|
|
1921
|
+
|
|
1922
|
+
// given
|
|
1923
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1924
|
+
var actual;
|
|
1925
|
+
|
|
1926
|
+
customRules.addRule('shape.replace', function(context) {
|
|
1927
|
+
actual = context.element;
|
|
1928
|
+
});
|
|
1929
|
+
|
|
1930
|
+
// when
|
|
1931
|
+
openPopup(startEvent);
|
|
1932
|
+
|
|
1933
|
+
// then
|
|
1934
|
+
expect(actual).to.equal(startEvent);
|
|
1935
|
+
}));
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
it('should evaluate rule once', inject(function(elementRegistry, popupMenu, customRules) {
|
|
1939
|
+
|
|
1940
|
+
// given
|
|
1941
|
+
var callCount = 0;
|
|
1942
|
+
var startEvent = elementRegistry.get('StartEvent_1');
|
|
1943
|
+
|
|
1944
|
+
customRules.addRule('shape.replace', function() {
|
|
1945
|
+
callCount++;
|
|
1946
|
+
});
|
|
1947
|
+
|
|
1948
|
+
// when
|
|
1949
|
+
openPopup(startEvent);
|
|
1950
|
+
|
|
1951
|
+
// then
|
|
1952
|
+
expect(callCount).to.equal(1);
|
|
1953
|
+
}));
|
|
1954
|
+
|
|
1955
|
+
});
|
|
1956
|
+
|
|
1957
|
+
});
|