test(snapping): add participant snapping test case

Related to #290
This commit is contained in:
Nico Rehwaldt 2015-06-03 17:47:24 +02:00
parent cced954f37
commit 19673a340c
2 changed files with 34 additions and 2 deletions

View File

@ -132,8 +132,8 @@ function BpmnSnapping(eventBus, canvas) {
if (is(shape, 'bpmn:Participant')) { if (is(shape, 'bpmn:Participant')) {
context.minDimensions = { width: 400, height: 200 }; context.minDimensions = { width: 400, height: 200 };
context.childrenBoxPadding = { context.childrenBoxPadding = {
left: 50, left: 50,
right: 35 right: 35
}; };
} }

View File

@ -168,6 +168,7 @@ describe('features/snapping - BpmnSnapping', function() {
describe('on shape resize', function () { describe('on shape resize', function () {
var diagramXML = require('../../../fixtures/bpmn/collaboration-resize.bpmn'); var diagramXML = require('../../../fixtures/bpmn/collaboration-resize.bpmn');
var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ]; var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ];
@ -181,6 +182,36 @@ describe('features/snapping - BpmnSnapping', function() {
})); }));
describe('Participant min bounds', function() {
it('should snap <se>', inject(function(canvas, elementRegistry, resize, dragging) {
var participant = elementRegistry.get('Participant_2');
resize.activate(Events.create(canvas._svg, { x: 500, y: 500 }), participant, 'se');
dragging.move(Events.create(canvas._svg, { x: 0, y: 0 }));
dragging.end();
expect(participant.width).toEqual(400);
expect(participant.height).toEqual(200);
}));
it('should snap from <nw>', inject(function(canvas, elementRegistry, resize, dragging) {
var participant = elementRegistry.get('Participant_2');
resize.activate(Events.create(canvas._svg, { x: 0, y: 0 }), participant, 'nw');
dragging.move(Events.create(canvas._svg, { x: 500, y: 500 }));
dragging.end();
expect(participant.width).toEqual(400);
expect(participant.height).toEqual(200);
}));
});
it('should snap a SubProcess to minimum bounds', inject(function(canvas, elementRegistry, resize, dragging) { it('should snap a SubProcess to minimum bounds', inject(function(canvas, elementRegistry, resize, dragging) {
var subProcess = elementRegistry.get('SubProcess_1'); var subProcess = elementRegistry.get('SubProcess_1');
@ -206,6 +237,7 @@ describe('features/snapping - BpmnSnapping', function() {
expect(participant.height).toEqual(200); expect(participant.height).toEqual(200);
})); }));
it('should snap a TextAnnotation to minimum bounds', inject(function(canvas, elementRegistry, resize, dragging) { it('should snap a TextAnnotation to minimum bounds', inject(function(canvas, elementRegistry, resize, dragging) {
var textAnnotation = elementRegistry.get('TextAnnotation_1'); var textAnnotation = elementRegistry.get('TextAnnotation_1');