Skip to content
7 changes: 6 additions & 1 deletion test/jasmine/tests/annotations_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ describe('annotations autosize', function() {
var fullLayout = gd._fullLayout;
var PREC = 1;

// xaxis2 need a bit more tolerance to pass on CI
// this most likely due to the different text bounding box values
// on headfull vs headless browsers.
var PREC2 = 0.1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused - isn't this less tolerance?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I guess precision is supposed to be a number of digits, like the built-in toBeCloseTo... in which case I guess coercePosition shouldn't really treat 0 as special, 0 is just +/- 0.5... but that's an issue for another time. 💃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I guess precision is supposed to be a number of digits, like the built-in toBeCloseTo.

Exactly. Maybe we should add an array version of toBeWithin down the road too.


expect(fullLayout.xaxis.range).toBeCloseToArray(x, PREC, '- xaxis');
expect(fullLayout.yaxis.range).toBeCloseToArray(y, PREC, '- yaxis');
expect(fullLayout.xaxis2.range).toBeCloseToArray(x2, PREC, 'xaxis2');
expect(fullLayout.xaxis2.range).toBeCloseToArray(x2, PREC2, 'xaxis2');
expect(fullLayout.yaxis2.range).toBeCloseToArray(y2, PREC, 'yaxis2');
expect(fullLayout.xaxis3.range).toBeCloseToArray(x3, PREC, 'xaxis3');
expect(fullLayout.yaxis3.range).toBeCloseToArray(y3, PREC, 'yaxis3');
Expand Down