Skip to content

Commit e1880c1

Browse files
committed
more permissive Drawing.bBox test
1 parent 2116a12 commit e1880c1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/jasmine/tests/drawing_test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,14 @@ describe('Drawing', function() {
356356
afterEach(destroyGraphDiv);
357357

358358
function assertBBox(actual, expected) {
359-
var TOL = 3;
360-
expect(actual.height).toBeWithin(expected.height, TOL, 'height');
361-
expect(actual.top).toBeWithin(expected.top, TOL, 'top');
362-
expect(actual.bottom).toBeWithin(expected.bottom, TOL, 'bottom');
363-
364-
expect(actual.width).toBeWithin(expected.width, TOL, 'width');
365-
expect(actual.left).toBeWithin(expected.left, TOL, 'left');
366-
expect(actual.right).toBeWithin(expected.right, TOL, 'right');
359+
[
360+
'height', 'top', 'bottom',
361+
'width', 'left', 'right'
362+
].forEach(function(dim) {
363+
// give larger dimensions some extra tolerance
364+
var tol = Math.max(expected[dim] / 10, 3);
365+
expect(actual[dim]).toBeWithin(expected[dim], tol, dim);
366+
});
367367
}
368368

369369
it('should update bounding box dimension on window scroll', function(done) {
@@ -434,10 +434,10 @@ describe('Drawing', function() {
434434

435435
assertBBox(Drawing.bBox(node), {
436436
height: 21,
437-
width: 80,
437+
width: 76,
438438
left: 0,
439439
top: -17,
440-
right: 80,
440+
right: 76,
441441
bottom: 4
442442
});
443443

0 commit comments

Comments
 (0)