mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-22 23:08:49 +00:00
parent
722c86beb2
commit
d8098c2feb
@ -38,7 +38,8 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||||||
var businessObject = getBusinessObject(element),
|
var businessObject = getBusinessObject(element),
|
||||||
newBusinessObject = bpmnFactory.create(businessObject.$type);
|
newBusinessObject = bpmnFactory.create(businessObject.$type);
|
||||||
|
|
||||||
var properties = getProperties(businessObject.$descriptor);
|
var properties = getProperties(businessObject.$descriptor),
|
||||||
|
colors = {};
|
||||||
|
|
||||||
properties = filter(properties, function(property) {
|
properties = filter(properties, function(property) {
|
||||||
return IGNORED_PROPERTIES.indexOf(property.replace(/bpmn:/, '')) === -1;
|
return IGNORED_PROPERTIES.indexOf(property.replace(/bpmn:/, '')) === -1;
|
||||||
@ -50,6 +51,10 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||||||
|
|
||||||
setProperties(descriptor, businessObject.di, [ 'isExpanded' ]);
|
setProperties(descriptor, businessObject.di, [ 'isExpanded' ]);
|
||||||
|
|
||||||
|
setProperties(colors, businessObject.di, [ 'fill', 'stroke' ]);
|
||||||
|
|
||||||
|
descriptor.colors = colors;
|
||||||
|
|
||||||
if (element.type === 'label') {
|
if (element.type === 'label') {
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,41 @@ describe('features/copy-paste', function() {
|
|||||||
|
|
||||||
it('selected elements', inject(integrationTest([ 'SubProcess_1kd6ist' ])));
|
it('selected elements', inject(integrationTest([ 'SubProcess_1kd6ist' ])));
|
||||||
|
|
||||||
|
it('should retain color properties',
|
||||||
|
inject(function(modeling, copyPaste, canvas, elementRegistry) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var task = elementRegistry.get('Task_1fo63a7'),
|
||||||
|
rootElement = canvas.getRootElement(),
|
||||||
|
newTask,
|
||||||
|
fill = '#BBDEFB',
|
||||||
|
stroke = '#1E88E5';
|
||||||
|
|
||||||
|
|
||||||
|
// when
|
||||||
|
modeling.setColor(task, { fill: fill, stroke: stroke });
|
||||||
|
|
||||||
|
copyPaste.copy([ task ]);
|
||||||
|
|
||||||
|
copyPaste.paste({
|
||||||
|
element: rootElement,
|
||||||
|
point: {
|
||||||
|
x: 1100,
|
||||||
|
y: 250
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
newTask = elementRegistry.filter(function(element) {
|
||||||
|
return element.parent === rootElement && element.type === 'bpmn:Task' && element.id !== 'Task_1fo63a7';
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(newTask.type).to.equal('bpmn:Task');
|
||||||
|
expect(newTask.businessObject.di.fill).to.equal(fill);
|
||||||
|
expect(newTask.businessObject.di.stroke).to.equal(stroke);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user