chore(test): adjust existing test cases related to labels

Related to #601
This commit is contained in:
pedesen 2016-09-01 18:01:04 +02:00
parent c13ac91e94
commit 9010554282
6 changed files with 40 additions and 28 deletions

View File

@ -104,7 +104,9 @@ describe('features/copy-paste', function() {
expect(newEvent.label.x - newEvent.x).to.equal(startEventLabel.x - startEvent.x);
expect(newEvent.label.y - newEvent.y).to.equal(startEventLabel.y - startEvent.y);
expect(newFlow.label.x - newFlow.waypoints[0].x).to.equal(seqFlowLabel.x - seqFlow.waypoints[0].x);
var seqFlowDeltaX = seqFlow.label.x - seqFlow.waypoints[0].x;
expect(newFlow.label.x - newFlow.waypoints[0].x).to.be.within(seqFlowDeltaX, seqFlowDeltaX + 1);
expect(newFlow.label.y - newFlow.waypoints[0].y).to.equal(seqFlowLabel.y - seqFlow.waypoints[0].y);
})
);

View File

@ -28,7 +28,7 @@ function triggerKeyEvent(element, event, code) {
return element.dispatchEvent(e);
}
describe.only('features - label-editing', function() {
describe('features - label-editing', function() {
var diagramXML = require('../../../fixtures/bpmn/features/label-editing/labels.bpmn');

View File

@ -43,7 +43,7 @@ describe('modeling - label layouting', function() {
var connection = modeling.connect(element1, element2);
// then
expect(connection.label.x).to.be.equal(427);
expect(connection.label.x).to.be.equal(472);
expect(connection.label.y).to.be.equal(332);
}));
@ -58,7 +58,7 @@ describe('modeling - label layouting', function() {
var connection = modeling.connect(element1, element2);
// then
expect(connection.label.x).to.be.equal(292);
expect(connection.label.x).to.be.equal(337);
expect(connection.label.y).to.be.equal(219.5);
}));
@ -92,10 +92,12 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expectLabelMoved(connection, labelPosition, { x: -82, y: 18 }); // waypoints mid
expect(connection.label.y - labelPosition.y).to.be.within(13, 16);
expect(connection.label.x - labelPosition.x).to.be.within(-82, -81);
}));
it('left - no relayout', inject(function(elementRegistry, connectionSegmentMove, dragging) {
// given
@ -128,7 +130,7 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expectLabelMoved(connection, labelPosition, { x: -70, y: 23 });
expectLabelMoved(connection, labelPosition, { x: -70, y: 24 });
}));
@ -164,7 +166,7 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expectLabelMoved(connection, labelPosition, { x: 70, y: -17 });
expectLabelMoved(connection, labelPosition, { x: 70, y: -16 });
}));
@ -247,8 +249,8 @@ describe('modeling - label layouting', function() {
modeling.reconnectStart(connection, shape, { x: 0, y: 0 });
// then
expect(Math.round(connection.label.x)).to.be.equal(528);
expect(Math.round(connection.label.y)).to.be.equal(137);
expect(Math.round(connection.label.x)).to.be.within(573, 575);
expect(Math.round(connection.label.y)).to.be.within(138, 139);
}));
@ -263,8 +265,8 @@ describe('modeling - label layouting', function() {
modeling.reconnectEnd(connection, shape, { x: 294, y: 270 });
// then
expect(Math.round(connection.label.x)).to.be.equal(215);
expect(Math.round(connection.label.y)).to.be.equal(184);
expect(Math.round(connection.label.x)).to.be.within(258, 260);
expect(Math.round(connection.label.y)).to.be.within(185, 186);
}));
@ -307,8 +309,8 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(425);
expect(Math.round(connection.label.y)).to.be.equal(170);
expect(Math.round(connection.label.x)).to.be.equal(467);
expect(Math.round(connection.label.y)).to.be.within(170, 171);
}));
@ -329,7 +331,7 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(477);
expect(Math.round(connection.label.x)).to.be.equal(518);
expect(Math.round(connection.label.y)).to.be.equal(507);
}));
@ -348,8 +350,8 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(380);
expect(Math.round(connection.label.y)).to.be.equal(190);
expect(Math.round(connection.label.x)).to.be.within(419, 421);
expect(Math.round(connection.label.y)).to.be.equal(191);
}));
@ -372,7 +374,7 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(211);
expect(Math.round(connection.label.x)).to.be.within(250, 251);
expect(Math.round(connection.label.y)).to.be.equal(152);
}));
@ -396,8 +398,8 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(197);
expect(Math.round(connection.label.y)).to.be.equal(147);
expect(Math.round(connection.label.x)).to.be.within(240, 242);
expect(Math.round(connection.label.y)).to.be.equal(148);
}));
@ -419,8 +421,8 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expect(Math.round(connection.label.x)).to.be.equal(426);
expect(Math.round(connection.label.y)).to.be.equal(287);
expect(Math.round(connection.label.x)).to.be.within(463, 465);
expect(Math.round(connection.label.y)).to.be.within(290, 293);
}));
@ -500,7 +502,8 @@ describe('modeling - label layouting', function() {
dragging.end();
// then
expectLabelMoved(connection, labelPosition, { x: -45, y: -70 });
expect(connection.label.y - labelPosition.y).to.be.within(-76, -72);
expect(connection.label.x - labelPosition.x).to.be.within(-53, -51);
}));

View File

@ -81,7 +81,7 @@ describe('behavior - LabelBehavior', function() {
expect(label).to.exist;
expect(elementRegistry.get(label.id)).to.exist;
expect(label).to.have.bounds(assign({ x: 262, y: 138 }, LabelUtil.DEFAULT_LABEL_SIZE));
expect(label).to.have.bounds(assign({ x: 307, y: 138, width: 0, height: 0 }));
}));
@ -134,8 +134,8 @@ describe('behavior - LabelBehavior', function() {
modeling.moveElements([ labelShape ], { x: 10, y: -10 });
// then
expect(labelShape).to.have.position({ x: 156, y: 128 });
expect(startEvent.di.label).to.have.position({ x: 156, y: 128 });
expect(labelShape).to.have.position({ x: 201, y: 128 });
expect(startEvent.di.label).to.have.position({ x: 201, y: 128 });
}));

View File

@ -537,7 +537,7 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.end();
expect(label.x).to.equal(161);
expect(label.x).to.be.within(192, 193);
}));

View File

@ -48,8 +48,15 @@ describe('import - labels', function() {
sequenceFlow = elementRegistry.get('SequenceFlow_1');
// then
expect(endEvent.label).to.have.bounds({ x: 211, y: 256, width: 119, height: 44 });
expect(sequenceFlow.label).to.have.bounds({ x: 432, y: 317, width: 99, height: 22 });
expect(endEvent.label.x).to.be.within(236, 237);
expect(endEvent.label.y).to.be.within(256, 256);
expect(endEvent.label.width).to.be.within(68, 69);
expect(endEvent.label.height).to.be.within(25, 30);
expect(sequenceFlow.label.x).to.be.within(441, 442);
expect(sequenceFlow.label.y).to.be.within(316, 317);
expect(sequenceFlow.label.width).to.be.within(79, 82);
expect(sequenceFlow.label.height).to.be.within(13, 15);
done();
})();