parent
f177a462ea
commit
d55e3afe35
|
@ -84,17 +84,26 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|||
|
||||
var references;
|
||||
|
||||
function resolveReferences(descriptor) {
|
||||
function resolveReferences(descriptor, cache) {
|
||||
var businessObject = getBusinessObject(descriptor);
|
||||
|
||||
// default sequence flows
|
||||
if (descriptor.default) {
|
||||
|
||||
// relationship cannot be resolved immediately
|
||||
references[ descriptor.default ] = {
|
||||
element: businessObject,
|
||||
property: 'default'
|
||||
};
|
||||
}
|
||||
|
||||
// boundary events
|
||||
if (descriptor.host) {
|
||||
|
||||
// relationship can be resolved immediately
|
||||
getBusinessObject(descriptor).attachedToRef = getBusinessObject(cache[ descriptor.host ]);
|
||||
}
|
||||
|
||||
references = omit(references, reduce(references, function(array, reference, key) {
|
||||
var element = reference.element,
|
||||
property = reference.property;
|
||||
|
@ -134,7 +143,7 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
|
|||
);
|
||||
|
||||
// resolve references e.g. default sequence flow
|
||||
resolveReferences(descriptor);
|
||||
resolveReferences(descriptor, cache);
|
||||
|
||||
copyProperties(descriptor, newBusinessObject, [
|
||||
'isExpanded',
|
||||
|
|
|
@ -167,6 +167,38 @@ describe('features/copy-paste', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should copy attacher properties', inject(function(canvas, copyPaste, elementRegistry) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1'),
|
||||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
copyPaste.copy([ task, boundaryEvent ]);
|
||||
|
||||
var elements = copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1000,
|
||||
y: 1000
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
task = find(elements, function(element) {
|
||||
return is(element, 'bpmn:Task');
|
||||
});
|
||||
|
||||
boundaryEvent = find(elements, function(element) {
|
||||
return is(element, 'bpmn:BoundaryEvent');
|
||||
});
|
||||
|
||||
// then
|
||||
expect(getBusinessObject(boundaryEvent).attachedToRef).to.equal(getBusinessObject(task));
|
||||
}));
|
||||
|
||||
|
||||
it('should copy loop characteristics porperties',
|
||||
inject(function(canvas, copyPaste, elementRegistry, modeling) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue