@@ -591,14 +591,14 @@ describe('A funnel plot', function() {
591591 return node . querySelectorAll ( 'g.point' ) ;
592592 }
593593
594- function assertTextIsInsidePath ( textNode , pathNode ) {
594+ function assertTextIsInsidePath ( textNode , pathNode , errorMargin = 0 ) {
595595 var textBB = textNode . getBoundingClientRect ( ) ;
596596 var pathBB = pathNode . getBoundingClientRect ( ) ;
597597
598- expect ( pathBB . left ) . not . toBeGreaterThan ( textBB . left ) ;
599- expect ( textBB . right ) . not . toBeGreaterThan ( pathBB . right ) ;
600- expect ( pathBB . top ) . not . toBeGreaterThan ( textBB . top ) ;
601- expect ( textBB . bottom ) . not . toBeGreaterThan ( pathBB . bottom ) ;
598+ expect ( pathBB . left - errorMargin ) . not . toBeGreaterThan ( textBB . left ) ;
599+ expect ( textBB . right - errorMargin ) . not . toBeGreaterThan ( pathBB . right ) ;
600+ expect ( pathBB . top - errorMargin ) . not . toBeGreaterThan ( textBB . top ) ;
601+ expect ( textBB . bottom - errorMargin ) . not . toBeGreaterThan ( pathBB . bottom ) ;
602602 }
603603
604604 function assertTextIsAbovePath ( textNode , pathNode ) {
@@ -969,7 +969,7 @@ describe('A funnel plot', function() {
969969 assertTextIsInsidePath ( text03 , path03 ) ; // inside
970970 assertTextIsInsidePath ( text12 , path12 ) ; // inside
971971 assertTextIsInsidePath ( text20 , path20 ) ; // inside
972- assertTextIsInsidePath ( text30 , path30 ) ; // inside
972+ assertTextIsInsidePath ( text30 , path30 , 0.5 ) ; // inside
973973 } )
974974 . then ( done , done . fail ) ;
975975 } ) ;
0 commit comments