Skip to content

Commit

Permalink
fix(create-participant-behavior): ensure available children
Browse files Browse the repository at this point in the history
* Ensure there are leftover children to calculate createConstraints

Closes #1133
  • Loading branch information
Niklas Kiefer authored and merge-me[bot] committed Aug 5, 2019
1 parent f5d55fe commit 5d5f33c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/features/modeling/behavior/CreateParticipantBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export default function CreateParticipantBehavior(canvas, eventBus, modeling) {
!isConnection(element);
});

// ensure for available children to calculate bounds
if (!children.length) {
return;
}

var childrenBBox = getBBox(children);

var participantBounds = getParticipantBounds(shape, childrenBBox);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,39 @@ describe('features/modeling - create participant', function() {

});


describe('fitting participant (only groups)', function() {

var processDiagramXML = require('../../../../fixtures/bpmn/collaboration/process-empty.bpmn');

beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));

it('should fit participant', inject(
function(canvas, create, dragging, elementFactory, modeling) {

// given
var process = canvas.getRootElement(),
processGfx = canvas.getGraphics(process),
participant = elementFactory.createParticipantShape(),
participantBo = participant.businessObject,
groupElement = elementFactory.createShape({ type: 'bpmn:Group' });

modeling.createShape(groupElement, { x: 100, y: 100 }, process);

// when
create.start(canvasEvent({ x: 100, y: 100 }), participant);
dragging.hover({ element: process, gfx: processGfx });

// then
var defaultSize = elementFactory._getDefaultSize(participantBo);

expect(participant.width).to.equal(defaultSize.width);
expect(participant.height).to.equal(defaultSize.height);
}
));

});

});


Expand Down

0 comments on commit 5d5f33c

Please sign in to comment.