fix(replace-menu): add sub process to event sub process replace menu

Closes camunda/camunda-modeler#310
This commit is contained in:
Philipp Fromme 2016-06-14 10:24:12 +02:00 committed by pedesen
parent e3144f8ad7
commit 1b17d45260
3 changed files with 35 additions and 8 deletions

View File

@ -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;
};

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_opd4cBZiEeWgh4rX9Ivzlg" targetNamespace="http://activiti.org/bpmn" exporter="camunda modeler" exporterVersion="2.7.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_opd4cBZiEeWgh4rX9Ivzlg" targetNamespace="http://activiti.org/bpmn" exporter="Camunda Modeler" exporterVersion="1.0.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:task id="ParallelTask" name="ParallelTask">
<bpmn2:multiInstanceLoopCharacteristics />
@ -14,6 +14,7 @@
<bpmn2:subProcess id="SubProcess" />
<bpmn2:transaction id="Transaction" />
<bpmn2:adHocSubProcess id="AdHocSubProcess" />
<bpmn2:subProcess id="EventSubProcess" triggeredByEvent="true" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
@ -38,6 +39,9 @@
<bpmndi:BPMNShape id="AdHocSubProcess_di" bpmnElement="AdHocSubProcess">
<dc:Bounds x="667" y="100" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_0oip8c9_di" bpmnElement="EventSubProcess" isExpanded="true">
<dc:Bounds x="101" y="474" width="350" height="200" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -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) {