fix(copy-paste): emit <moddleCopy.canSetCopiedProperty> with existing property

This commit is contained in:
Nico Rehwaldt 2020-03-02 13:52:35 +01:00 committed by fake-join[bot]
parent f5861dfade
commit 707257e020
2 changed files with 13 additions and 1 deletions

View File

@ -164,7 +164,7 @@ ModdleCopy.prototype.copyElement = function(sourceElement, targetElement, proper
var copiedProperty = self.copyProperty(sourceProperty, targetElement, propertyName);
var canSetProperty = self._eventBus.fire('moddleCopy.canSetCopiedProperty', {
parent: parent,
parent: targetElement,
property: copiedProperty,
propertyName: propertyName
});

View File

@ -607,6 +607,12 @@ describe('features/copy-paste/ModdleCopy', function() {
});
eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY, function(context) {
// verify provided properties
expect(context).to.have.property('parent');
expect(context).to.have.property('property');
expect(context).to.have.property('propertyName');
var propertyName = context.propertyName;
if (propertyName === 'name') {
@ -630,6 +636,12 @@ describe('features/copy-paste/ModdleCopy', function() {
});
eventBus.on('moddleCopy.canSetCopiedProperty', HIGH_PRIORITY, function(context) {
// verify provided properties
expect(context).to.have.property('parent');
expect(context).to.have.property('property');
expect(context).to.have.property('propertyName');
var property = context.property;
if (property === 'foo') {