diff --git a/lib/features/popup-menu/util/TypeUtil.js b/lib/features/popup-menu/util/TypeUtil.js index 6f2d7b5a..379d5b37 100644 --- a/lib/features/popup-menu/util/TypeUtil.js +++ b/lib/features/popup-menu/util/TypeUtil.js @@ -3,8 +3,9 @@ var getBusinessObject = require('../../../util/ModelUtil').getBusinessObject; /** - * Returns true, if an element is from a different type than a target definition. - * Takes into account the type and the event definition type. + * Returns true, if an element is from a different type + * than a target definition. Takes into account the type, + * event definition type and triggeredByEvent property. * * @param {djs.model.Base} element * @@ -19,9 +20,10 @@ function isDifferentType(element) { eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type; var isEventDefinitionEqual = target.eventDefinition == eventDefinition, - isTypeEqual = businessObject.$type == target.type; + isTypeEqual = businessObject.$type == target.type, + isTriggeredByEventEqual = businessObject.triggeredByEvent == target.triggeredByEvent; - return (!isEventDefinitionEqual && isTypeEqual) || !isTypeEqual; + return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual; }; } diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index 7e5c1a6c..92d463a8 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -545,6 +545,25 @@ describe('features/replace-menu', function() { })); + it('should replace sub processes -> event sub process', + inject(function(popupMenu, bpmnReplace, elementRegistry) { + + // given + var subProcess = elementRegistry.get('SubProcess'); + + openPopup(subProcess); + + var entry = queryEntry(popupMenu, 'replace-with-event-subprocess'); + + // when + // replacing the expanded sub process with a eventSubProcess + var eventSubProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 })); + + // then + expect(eventSubProcess.businessObject.triggeredByEvent).to.be.true; + })); + + it('should retain the loop characteristics and the expanded status for transactions', inject(function(popupMenu, bpmnReplace, elementRegistry) {