@@ -591,14 +591,14 @@ describe('A funnel plot', function() {
591
591
return node . querySelectorAll ( 'g.point' ) ;
592
592
}
593
593
594
- function assertTextIsInsidePath ( textNode , pathNode ) {
594
+ function assertTextIsInsidePath ( textNode , pathNode , errorMargin = 0 ) {
595
595
var textBB = textNode . getBoundingClientRect ( ) ;
596
596
var pathBB = pathNode . getBoundingClientRect ( ) ;
597
597
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 ) ;
602
602
}
603
603
604
604
function assertTextIsAbovePath ( textNode , pathNode ) {
@@ -969,7 +969,7 @@ describe('A funnel plot', function() {
969
969
assertTextIsInsidePath ( text03 , path03 ) ; // inside
970
970
assertTextIsInsidePath ( text12 , path12 ) ; // inside
971
971
assertTextIsInsidePath ( text20 , path20 ) ; // inside
972
- assertTextIsInsidePath ( text30 , path30 ) ; // inside
972
+ assertTextIsInsidePath ( text30 , path30 , 0.5 ) ; // inside
973
973
} )
974
974
. then ( done , done . fail ) ;
975
975
} ) ;
0 commit comments