Permalink
Browse files

fix(move-to-origin): ignore children of subprocesses

  • Loading branch information...
1 parent dd60e47 commit 1f667e0184c49bb09f1ef21c4dc3885f1b09b58b @philippfromme philippfromme committed Jan 9, 2017
@@ -100,7 +100,7 @@ function BpmnEditorActions(
});
} else {
elements = elementRegistry.filter(function(element) {
- return element !== rootElement;
+ return element !== rootElement && !is(element.parent, 'bpmn:SubProcess');
});
}
@@ -8,12 +8,14 @@ var pick = require('lodash/object/pick');
var getBBox = require('diagram-js/lib/util/Elements').getBBox;
+var getParent = require('lib/features/modeling/util/ModelingUtil').getParent;
+
var bpmnEditorActionsModule = require('../../../../lib/features/editor-actions'),
modelingModule = require('../../../../lib/features/modeling'),
coreModule = require('../../../../lib/core');
-var basicXML = require('../../../fixtures/bpmn/simple.bpmn'),
+var basicXML = require('../../../fixtures/bpmn/nested-subprocesses.bpmn'),
collaborationXML = require('../../../fixtures/bpmn/collaboration.bpmn');
@@ -48,6 +50,23 @@ describe('features/editor-actions', function() {
describe('collaboration', testMoveToOrigin(collaborationXML));
+ describe('subprocesses', function() {
+
+ beforeEach(bootstrapModeler(basicXML, { modules: [ bpmnEditorActionsModule, modelingModule, coreModule ] }));
+
+ it('should ignore children of subprocesses', inject(function(editorActions, elementRegistry) {
+ // given
+ var startEvent = elementRegistry.get('StartEvent_3'),
+ startEventParent = getParent(startEvent);
+
+ // when
+ editorActions.trigger('moveToOrigin');
+
+ // then
+ expect(getParent(startEvent)).to.equal(startEventParent);
+ }));
+ });
+
});
});

0 comments on commit 1f667e0

Please sign in to comment.