fix(copy-paste): copy name property

Closes #921
This commit is contained in:
Philipp Fromme 2019-08-07 20:32:47 +02:00 committed by merge-me[bot]
parent 2dd483b950
commit d6b8acc715
2 changed files with 40 additions and 1 deletions

View File

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

View File

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