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

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

Merged
merged 2 commits into from
Apr 29, 2019
Merged
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
2 changes: 1 addition & 1 deletion lib/features/modeling/ElementFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down
6 changes: 3 additions & 3 deletions test/spec/features/grid-snapping/BpmnGridSnappingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -179,7 +179,7 @@ describe('features/grid-snapping', function() {
);

// then
expect(collapsedParticipant).to.have.bounds(bounds);
expect(collapsedParticipant).to.have.bounds(collapsedBounds);
}));


Expand Down
31 changes: 23 additions & 8 deletions test/spec/features/replace/BpmnReplaceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
}));


Expand All @@ -310,16 +318,19 @@ describe('features/replace - bpmn replace', function() {
// given
var shape = elementRegistry.get('Participant_2');

var expandedBounds = assign({}, getBounds(shape), { height: 250 });

// when
var newShape = bpmnReplace.replaceElement(shape, { type: 'bpmn:Participant', isExpanded: true });
var newShape = bpmnReplace.replaceElement(shape, {
type: 'bpmn:Participant',
isExpanded: true
});

// then
expect(isExpanded(newShape)).to.be.true; // expanded
expect(newShape.children).to.be.empty;

expect(newShape.width).to.equal(shape.width);
// default height for expanded pool
expect(newShape.height).to.equal(250);
expect(newShape).to.have.bounds(expandedBounds);
}));

});
Expand Down Expand Up @@ -1513,3 +1524,7 @@ function skipId(key, value) {

return value;
}

function getBounds(shape) {
return pick(shape, [ 'x', 'y', 'width', 'height' ]);
}