Skip to content

Commit

Permalink
chore: merge main to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bpmn-io-bot committed Apr 29, 2024
2 parents 6c3cbe0 + 407a191 commit 4d0c0f4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/features/context-pad/ContextPadProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export default function ContextPadProvider(
entries.replace.action.click(event, shape);
}
});

eventBus.on('contextPad.close', function() {
appendPreview.cleanUp();
});
}

ContextPadProvider.$inject = [
Expand Down Expand Up @@ -244,16 +248,12 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
create.start(event, shape, {
source: element
});

appendPreview.cleanUp();
}

var append = autoPlace ? function(_, element) {
var shape = elementFactory.createShape(assign({ type: type }, options));

autoPlace.append(element, shape);

appendPreview.cleanUp();
} : appendStart;

var previewAppend = autoPlace ? function(_, element) {
Expand Down
23 changes: 23 additions & 0 deletions test/spec/features/context-pad/ContextPadProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,29 @@ describe('features - context-pad', function() {
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2);
}));


it('should remove append preview on close', inject(function(canvas, elementRegistry, contextPad) {

// given
var element = elementRegistry.get('Task_1');

contextPad.open(element);

// mock event
var event = padEvent('append.gateway');

contextPad.trigger('hover', event);

expect(canvas.getLayer('complex-preview')).to.exist;
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2);

// when
contextPad.close();

// then
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(0);
}));

});

});
Expand Down

0 comments on commit 4d0c0f4

Please sign in to comment.