Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(copy-paste): fix default sequence flow default propertie are not enumerable #1936

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lib/features/copy-paste/BpmnCopyPaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ var LOW_PRIORITY = 750;
* @param {BpmnFactory} bpmnFactory
* @param {EventBus} eventBus
* @param {ModdleCopy} moddleCopy
* @param {Moddle} moddle
*/
export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy, moddle) {

function copy(bo, clone) {
var targetBo = bpmnFactory.create(bo.$type);
Expand Down Expand Up @@ -105,10 +106,18 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {

return omit(references, reduce(references, function(array, reference, key) {
var element = reference.element,
property = reference.property;
property = reference.property,
propertyDescriptor = moddle.getPropertyDescriptor(element, property);


if (key === descriptor.id) {
element[ property ] = businessObject;

Object.defineProperty(element, property, {
enumerable: !propertyDescriptor.isReference,
value: businessObject,
writable: true,
configurable: true
});

array.push(descriptor.id);
}
Expand Down Expand Up @@ -189,5 +198,6 @@ export default function BpmnCopyPaste(bpmnFactory, eventBus, moddleCopy) {
BpmnCopyPaste.$inject = [
'bpmnFactory',
'eventBus',
'moddleCopy'
'moddleCopy',
'moddle'
];
7 changes: 4 additions & 3 deletions test/spec/features/copy-paste/BpmnCopyPasteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ describe('features/copy-paste', function() {

expect(conditionalFlow).to.exist;
expect(defaultFlow).to.exist;
expect(Object.prototype.propertyIsEnumerable.call(taskBo,'default')).to.be.false;
})
);


it('should copy attacher properties', inject(function(canvas, copyPaste, elementRegistry) {
it('should copy attached properties', inject(function(canvas, copyPaste, elementRegistry) {

// given
var task = elementRegistry.get('Task_1'),
Expand Down Expand Up @@ -300,7 +301,7 @@ describe('features/copy-paste', function() {
}));


it('should copy loop characteristics porperties',
it('should copy loop characteristics properties',
inject(function(canvas, copyPaste, elementRegistry, modeling) {

// given
Expand Down Expand Up @@ -375,7 +376,7 @@ describe('features/copy-paste', function() {


it('should copy label', inject(
function(canvas, copyPaste, elementRegistry, modeling) {
function(canvas, copyPaste, elementRegistry) {

// given
var startEvent = elementRegistry.get('StartEvent_1'),
Expand Down