parent
11165e2c21
commit
3f04e18398
|
@ -100,6 +100,10 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||
descriptor.parent = is(rootElement, 'bpmn:Collaboration') ? rootElement : parent;
|
||||
}
|
||||
|
||||
if (is(parent, 'bpmn:Lane')) {
|
||||
descriptor.parent = parent.parent;
|
||||
}
|
||||
|
||||
if (descriptor.type === 'bpmn:MessageFlow') {
|
||||
descriptor.parent = canvas.getRootElement();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,14 @@ function CopyPasteBehavior(eventBus, modeling, canvas) {
|
|||
if (!topParent.parent) {
|
||||
context.topParent = canvas.getRootElement();
|
||||
}
|
||||
|
||||
if (is(topParent, 'bpmn:Lane')) {
|
||||
do {
|
||||
// unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)
|
||||
topParent = context.topParent = topParent.parent.parent;
|
||||
|
||||
} while (is(topParent, 'bpmn:Lane'));
|
||||
}
|
||||
}, true);
|
||||
|
||||
this.postExecute('elements.paste', function(context) {
|
||||
|
|
|
@ -93,10 +93,12 @@ describe('features/copy-paste', function() {
|
|||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(shapes, 'type'),
|
||||
ids: mapProperty(shapes, 'id'),
|
||||
length: shapes.length
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
|
@ -109,10 +111,12 @@ describe('features/copy-paste', function() {
|
|||
commandStack.redo();
|
||||
commandStack.redo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(elementRegistry.getAll(), 'type'),
|
||||
ids: mapProperty(elementRegistry.getAll(), 'id'),
|
||||
length: shapes.length
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
|
@ -362,6 +366,35 @@ describe('features/copy-paste', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(collaborationMultipleXML, { modules: testModules }));
|
||||
|
||||
describe('basics', function() {
|
||||
|
||||
it('pasting on lane', inject(function(elementRegistry, copyPaste) {
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_1yo0kyz'),
|
||||
task = elementRegistry.get('Task_0n0k2nj'),
|
||||
participant = elementRegistry.get('Participant_0pgdgt4');
|
||||
|
||||
// when
|
||||
copyPaste.copy(task);
|
||||
|
||||
copyPaste.paste({
|
||||
element: lane,
|
||||
point: {
|
||||
x: 200,
|
||||
y: 75
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(lane.children).to.be.empty;
|
||||
expect(lane.businessObject.flowNodeRef).to.have.length(2);
|
||||
|
||||
expect(lane.parent.children).to.have.length(2);
|
||||
expect(participant.children).to.have.length(5);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||
|
|
Loading…
Reference in New Issue