From 1b17d452601f861e8578995f7d86cb5a633fe7b6 Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Tue, 14 Jun 2016 10:24:12 +0200 Subject: [PATCH] fix(replace-menu): add sub process to event sub process replace menu Closes camunda/camunda-modeler#310 --- lib/features/popup-menu/util/TypeUtil.js | 17 +++++++++------- .../bpmn/draw/activity-markers-simple.bpmn | 6 +++++- .../popup-menu/ReplaceMenuProviderSpec.js | 20 +++++++++++++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/features/popup-menu/util/TypeUtil.js b/lib/features/popup-menu/util/TypeUtil.js index f1711a82..9705bb7a 100644 --- a/lib/features/popup-menu/util/TypeUtil.js +++ b/lib/features/popup-menu/util/TypeUtil.js @@ -22,15 +22,18 @@ function isDifferentType(element) { var isTypeEqual = businessObject.$type === target.type; - var isEventDefinitionEqual = - (eventDefinition && eventDefinition.$type) === target.eventDefinitionType; + var isEventDefinitionEqual = ( + (eventDefinition && eventDefinition.$type) === target.eventDefinitionType + ); - var isTriggeredByEventEqual = - target.triggeredByEvent === undefined || - businessObject.triggeredByEvent === target.triggeredByEvent; + var isTriggeredByEventEqual = ( + businessObject.triggeredByEvent === target.triggeredByEvent + ); - var isExpandedEqual = - target.isExpanded === undefined || target.isExpanded === isExpanded(businessObject); + var isExpandedEqual = ( + target.isExpanded === undefined || + target.isExpanded === isExpanded(businessObject) + ); return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual; }; diff --git a/test/fixtures/bpmn/draw/activity-markers-simple.bpmn b/test/fixtures/bpmn/draw/activity-markers-simple.bpmn index 444714c1..f2bd4c53 100644 --- a/test/fixtures/bpmn/draw/activity-markers-simple.bpmn +++ b/test/fixtures/bpmn/draw/activity-markers-simple.bpmn @@ -1,5 +1,5 @@ - + @@ -14,6 +14,7 @@ + @@ -38,6 +39,9 @@ + + + diff --git a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js index 75d42693..4b3d5141 100644 --- a/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +++ b/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js @@ -583,6 +583,26 @@ describe('features/popup-menu - replace menu provider', function() { ); + it('should replace event sub processes -> sub process', + inject(function(popupMenu, bpmnReplace, elementRegistry) { + + // given + var eventSubProcess = elementRegistry.get('EventSubProcess'); + + openPopup(eventSubProcess); + + var entry = queryEntry(popupMenu, 'replace-with-subprocess'); + + // when + // replacing the expanded sub process with a eventSubProcess + var subProcess = popupMenu.trigger(globalEvent(entry, { x: 0, y: 0 })); + + // then + expect(subProcess.businessObject.triggeredByEvent).to.be.false; + }) + ); + + it('should retain the loop characteristics and the expanded status for transactions', inject(function(popupMenu, bpmnReplace, elementRegistry) {