diff --git a/lib/features/copy-paste/BpmnCopyPaste.js b/lib/features/copy-paste/BpmnCopyPaste.js index f66694f6..0060df80 100644 --- a/lib/features/copy-paste/BpmnCopyPaste.js +++ b/lib/features/copy-paste/BpmnCopyPaste.js @@ -48,6 +48,8 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) { descriptor.type = element.type; + copyProperties(businessObject, descriptor, 'name'); + descriptor.di = {}; // fill and stroke will be set to DI @@ -134,7 +136,10 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) { // resolve references e.g. default sequence flow resolveReferences(descriptor); - copyProperties(descriptor, newBusinessObject, 'isExpanded'); + copyProperties(descriptor, newBusinessObject, [ + 'isExpanded', + 'name' + ]); removeProperties(descriptor, 'oldBusinessObject'); }); diff --git a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js index 4ce32057..9b6d5588 100644 --- a/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +++ b/test/spec/features/copy-paste/BpmnCopyPasteSpec.js @@ -235,6 +235,40 @@ describe('features/copy-paste', function() { }) ); + + it('should copy name property', inject( + function(canvas, copyPaste, elementRegistry, modeling) { + + // given + var startEvent = elementRegistry.get('StartEvent_1'), + rootElement = canvas.getRootElement(); + + copyPaste.copy(startEvent); + + modeling.removeShape(startEvent); + + // when + var elements = copyPaste.paste({ + element: rootElement, + point: { + x: 300, + y: 300 + } + }); + + // then + expect(elements).to.have.length(2); + + startEvent = find(elements, function(element) { + return is(element, 'bpmn:StartEvent'); + }); + + var startEventBo = getBusinessObject(startEvent); + + expect(startEventBo.name).to.equal('hello'); + } + )); + });