@@ -356,14 +356,14 @@ describe('Drawing', function() {
356
356
afterEach ( destroyGraphDiv ) ;
357
357
358
358
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
+ } ) ;
367
367
}
368
368
369
369
it ( 'should update bounding box dimension on window scroll' , function ( done ) {
@@ -434,10 +434,10 @@ describe('Drawing', function() {
434
434
435
435
assertBBox ( Drawing . bBox ( node ) , {
436
436
height : 21 ,
437
- width : 80 ,
437
+ width : 76 ,
438
438
left : 0 ,
439
439
top : - 17 ,
440
- right : 80 ,
440
+ right : 76 ,
441
441
bottom : 4
442
442
} ) ;
443
443
0 commit comments