Skip to content

Commit

Permalink
fix(label-editing): resize empty text annotations on complete
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Mar 10, 2020
1 parent 96cd55a commit e4e789b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 0 additions & 5 deletions lib/features/label-editing/cmd/UpdateLabelHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ export default function UpdateLabelHandler(modeling, textRenderer) {

var text = getLabel(label);

// don't resize without text
if (!text) {
return;
}

// resize element based on label _or_ pre-defined bounds
if (typeof newBounds === 'undefined') {
newBounds = textRenderer.getExternalLabelBounds(label, text);
Expand Down
17 changes: 16 additions & 1 deletion test/spec/features/modeling/UpdateLabelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('features/modeling - update label', function() {


it('should change name of start event', inject(
function(modeling, elementRegistry, eventBus) {
function(modeling, elementRegistry) {

// given
var startEvent_1 = elementRegistry.get('StartEvent_1');
Expand Down Expand Up @@ -190,4 +190,19 @@ describe('features/modeling - update label', function() {
}
));


it('should resize empty text annotation', inject(function(modeling, elementRegistry) {

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

var newBounds = { x: 100, y: 100, width: 100, height: 30 };

// when
modeling.updateLabel(element, null, newBounds);

// then
expect(element).to.have.bounds(newBounds);
}));

});

0 comments on commit e4e789b

Please sign in to comment.