@@ -17,6 +17,9 @@ var fail = require('../assets/fail_test');
1717var customAssertions = require ( '../assets/custom_assertions' ) ;
1818var assertHoverLabelStyle = customAssertions . assertHoverLabelStyle ;
1919var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
20+ var assertElemRightTo = customAssertions . assertElemRightTo ;
21+ var assertElemTopsAligned = customAssertions . assertElemTopsAligned ;
22+ var assertElemInside = customAssertions . assertElemInside ;
2023
2124describe ( 'hover info' , function ( ) {
2225 'use strict' ;
@@ -1136,15 +1139,6 @@ describe('hover info', function() {
11361139 msgPrefixFmt + 'Primary text inside box' ) ;
11371140 assertElemInside ( nodes . secondaryText , nodes . secondaryBox ,
11381141 msgPrefixFmt + 'Secondary text inside box' ) ;
1139-
1140- function assertElemInside ( elem , container , msg ) {
1141- var elemBB = elem . getBoundingClientRect ( ) ;
1142- var contBB = container . getBoundingClientRect ( ) ;
1143- expect ( contBB . left < elemBB . left &&
1144- contBB . right > elemBB . right &&
1145- contBB . top < elemBB . top &&
1146- contBB . bottom > elemBB . bottom ) . toBe ( true , msg ) ;
1147- }
11481142 }
11491143
11501144 function assertSecondaryRightToPrimaryBox ( nodes , msgPrefix ) {
@@ -1154,22 +1148,6 @@ describe('hover info', function() {
11541148 msgPrefixFmt + 'Secondary box right to primary box' ) ;
11551149 assertElemTopsAligned ( nodes . secondaryBox , nodes . primaryBox ,
11561150 msgPrefixFmt + 'Top edges of primary and secondary boxes aligned' ) ;
1157-
1158- function assertElemRightTo ( elem , refElem , msg ) {
1159- var elemBB = elem . getBoundingClientRect ( ) ;
1160- var refElemBB = refElem . getBoundingClientRect ( ) ;
1161- expect ( elemBB . left >= refElemBB . right ) . toBe ( true , msg ) ;
1162- }
1163-
1164- function assertElemTopsAligned ( elem1 , elem2 , msg ) {
1165- var elem1BB = elem1 . getBoundingClientRect ( ) ;
1166- var elem2BB = elem2 . getBoundingClientRect ( ) ;
1167-
1168- // Hint: toBeWithin tolerance is exclusive, hence a
1169- // diff of exactly 1 would fail the test
1170- var tolerance = 1.1 ;
1171- expect ( elem1BB . top - elem2BB . top ) . toBeWithin ( 0 , tolerance , msg ) ;
1172- }
11731151 }
11741152
11751153 describe ( 'centered' , function ( ) {
0 commit comments