fix(paste): copy process with participant

Closes camunda/camunda-modeler#297
This commit is contained in:
Vladimirs Katusenoks 2016-05-20 15:04:20 +02:00
parent 80d62b9873
commit 839ed0b8e8
2 changed files with 40 additions and 6 deletions

View File

@ -133,6 +133,10 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
descriptor.businessObject = businessObject = bpmnFactory.create(descriptor.type);
if (descriptor.type === 'bpmn:Participant' && descriptor.processRef) {
descriptor.processRef = businessObject.processRef = bpmnFactory.create('bpmn:Process');
}
setProperties(businessObject, descriptor, [
'name',
'text',

View File

@ -11,7 +11,8 @@ var bpmnCopyPasteModule = require('../../../../lib/features/copy-paste'),
coreModule = require('../../../../lib/core');
var map = require('lodash/collection/map'),
forEach = require('lodash/collection/forEach');
forEach = require('lodash/collection/forEach'),
uniq = require('lodash/array/uniq');
var DescriptorTree = require('./DescriptorTree');
@ -432,23 +433,52 @@ describe('features/copy-paste', function() {
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
});
});
describe('data associations', function() {
describe('participants', function() {
beforeEach(bootstrapModeler(collaborationAssociations, { modules: testModules }));
describe('integration', function() {
it('copying participant should copy process as well', inject(function(elementRegistry, copyPaste, canvas) {
// given
var participants = map([ 'Participant_Input', 'Participant_Output' ], function (e) {
return elementRegistry.get(e);
});
var rootElement = canvas.getRootElement();
// when
copyPaste.copy(participants);
copyPaste.paste({
element: rootElement,
point: {
x: 4000,
y: 4500
}
});
// then
var elements = elementRegistry.filter(function(element) {
return element.type === 'bpmn:Participant';
});
var processIds = map(elements, function (e) {
return e.businessObject.processRef.id;
});
expect(uniq(processIds)).to.have.length(4);
}));
it('participant with OutputDataAssociation', inject(integrationTest([ 'Participant_Output' ])));
it('participant with InputDataAssociation', inject(integrationTest([ 'Participant_Input' ])));
});
it('participant with InputDataAssociation', inject(integrationTest([ 'Participant_Input' ])));
});