mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-15 19:45:35 +00:00
test: allow for rounding errors
This commit is contained in:
parent
9b8c190625
commit
7838a1bd67
@ -405,10 +405,8 @@ describe('behavior - LabelBehavior', function() {
|
||||
]);
|
||||
|
||||
// then
|
||||
expect({
|
||||
x: sequenceFlowConnection.label.x,
|
||||
y: sequenceFlowConnection.label.y
|
||||
}).to.eql({ x: 273, y: 178 });
|
||||
expect(sequenceFlowConnection.label.x).to.be.closeTo(273, 1);
|
||||
expect(sequenceFlowConnection.label.y).to.be.closeTo(178, 1);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.updateWaypoints(sequenceFlow, newWaypoints, hints);
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 525, y: 110 },
|
||||
{ x: 355, y: 229 },
|
||||
]);
|
||||
@ -66,7 +66,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.moveElements([ startEvent, endEvent ], { x: 0, y: 200 });
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 525, y: 110 },
|
||||
{ x: 460, y: 350 },
|
||||
]);
|
||||
@ -90,7 +90,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.updateWaypoints(sequenceFlow, newWaypoints);
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 525, y: 110 },
|
||||
{ x: 460, y: 300 }
|
||||
]);
|
||||
@ -123,7 +123,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.updateWaypoints(sequenceFlow, newWaypoints, hints);
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 355, y: 229 },
|
||||
{ x: 525, y: 110 }
|
||||
]);
|
||||
@ -141,7 +141,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.moveElements([ startEvent, endEvent ], { x: 0, y: 200 });
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 460, y: 350 },
|
||||
{ x: 525, y: 110 }
|
||||
]);
|
||||
@ -166,7 +166,7 @@ describe('behavior - LayoutConnectionBehavior', function() {
|
||||
modeling.updateWaypoints(sequenceFlow, newWaypoints);
|
||||
|
||||
// then
|
||||
expectWaypoints(association, [
|
||||
expectApproximateWaypoints(association, [
|
||||
{ x: 460, y: 300 },
|
||||
{ x: 525, y: 110 }
|
||||
]);
|
||||
@ -196,7 +196,7 @@ function copyWaypoints(connection) {
|
||||
});
|
||||
}
|
||||
|
||||
function expectWaypoints(connection, expectedWaypoints) {
|
||||
function expectApproximateWaypoints(connection, expectedWaypoints) {
|
||||
|
||||
var actualWaypoints = connection.waypoints;
|
||||
|
||||
@ -206,7 +206,7 @@ function expectWaypoints(connection, expectedWaypoints) {
|
||||
expect(connection.waypoints.length).to.eql(expectedWaypoints.length);
|
||||
|
||||
for (var i in actualWaypoints) {
|
||||
expect(actualWaypoints[i].x).to.eql(expectedWaypoints[i].x);
|
||||
expect(actualWaypoints[i].y).to.eql(expectedWaypoints[i].y);
|
||||
expect(actualWaypoints[i].x).to.be.closeTo(expectedWaypoints[i].x, 1);
|
||||
expect(actualWaypoints[i].y).to.be.closeTo(expectedWaypoints[i].y, 1);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user