feat(modeling): adjust default collapsed participant height to 60px

This better aligns our collapse behavior with other tools.
This commit is contained in:
Nico Rehwaldt 2019-04-29 11:09:31 +02:00 committed by merge-me[bot]
parent 02848564cf
commit 5affe25705
3 changed files with 20 additions and 8 deletions

View File

@ -159,7 +159,7 @@ ElementFactory.prototype._getDefaultSize = function(semantic) {
if (is(semantic, 'bpmn:Participant')) {
if (!isExpanded(semantic)) {
return { width: 400, height: 100 };
return { width: 400, height: 60 };
} else {
return { width: 600, height: 250 };
}

View File

@ -165,9 +165,9 @@ describe('features/grid-snapping', function() {
it('participant (no auto resize)', inject(function(bpmnReplace) {
// given
var bounds = assign(
var collapsedBounds = assign(
getBounds(participant),
{ height: 100 }
{ height: 60 }
);
// when
@ -179,7 +179,7 @@ describe('features/grid-snapping', function() {
);
// then
expect(collapsedParticipant).to.have.bounds(bounds);
expect(collapsedParticipant).to.have.bounds(collapsedBounds);
}));

View File

@ -3,6 +3,11 @@ import {
inject
} from 'test/TestHelper';
import {
assign,
pick
} from 'min-dash';
import modelingModule from 'lib/features/modeling';
import replaceModule from 'lib/features/replace';
import moveModule from 'diagram-js/lib/features/move';
@ -292,16 +297,19 @@ describe('features/replace - bpmn replace', function() {
// given
var shape = elementRegistry.get('Participant_1');
var collapsedBounds = assign({}, getBounds(shape), { height: 60 });
// when
var newShape = bpmnReplace.replaceElement(shape, { type: 'bpmn:Participant', isExpanded: false });
var newShape = bpmnReplace.replaceElement(shape, {
type: 'bpmn:Participant',
isExpanded: false
});
// then
expect(isExpanded(newShape)).to.be.false; // collapsed
expect(newShape.children).to.be.empty;
expect(newShape.width).to.equal(shape.width);
// default height for collapsed pool
expect(newShape.height).to.equal(100);
expect(newShape).to.have.bounds(collapsedBounds);
}));
@ -1513,3 +1521,7 @@ function skipId(key, value) {
return value;
}
function getBounds(shape) {
return pick(shape, [ 'x', 'y', 'width', 'height' ]);
}