@@ -1195,14 +1195,14 @@ describe('A bar plot', function() {
1195
1195
return node . querySelectorAll ( 'g.point' ) ;
1196
1196
}
1197
1197
1198
- function assertTextIsInsidePath ( textNode , pathNode ) {
1198
+ function assertTextIsInsidePath ( textNode , pathNode , errorMargin = 0 ) {
1199
1199
var textBB = textNode . getBoundingClientRect ( ) ;
1200
1200
var pathBB = pathNode . getBoundingClientRect ( ) ;
1201
1201
1202
- expect ( pathBB . left ) . not . toBeGreaterThan ( textBB . left ) ;
1203
- expect ( textBB . right ) . not . toBeGreaterThan ( pathBB . right ) ;
1204
- expect ( pathBB . top ) . not . toBeGreaterThan ( textBB . top ) ;
1205
- expect ( textBB . bottom ) . not . toBeGreaterThan ( pathBB . bottom ) ;
1202
+ expect ( pathBB . left - errorMargin ) . not . toBeGreaterThan ( textBB . left ) ;
1203
+ expect ( textBB . right - errorMargin ) . not . toBeGreaterThan ( pathBB . right ) ;
1204
+ expect ( pathBB . top - errorMargin ) . not . toBeGreaterThan ( textBB . top ) ;
1205
+ expect ( textBB . bottom - errorMargin ) . not . toBeGreaterThan ( pathBB . bottom ) ;
1206
1206
}
1207
1207
1208
1208
function assertTextIsAbovePath ( textNode , pathNode ) {
@@ -1828,7 +1828,7 @@ describe('A bar plot', function() {
1828
1828
assertTextIsInsidePath ( text03 , path03 ) ; // inside
1829
1829
assertTextIsInsidePath ( text12 , path12 ) ; // inside
1830
1830
assertTextIsInsidePath ( text20 , path20 ) ; // inside
1831
- assertTextIsInsidePath ( text30 , path30 ) ; // inside
1831
+ assertTextIsInsidePath ( text30 , path30 , 0.5 ) ; // inside
1832
1832
} )
1833
1833
. then ( done , done . fail ) ;
1834
1834
} ) ;
0 commit comments