@@ -17,6 +17,9 @@ var fail = require('../assets/fail_test');
17
17
var customAssertions = require ( '../assets/custom_assertions' ) ;
18
18
var assertHoverLabelStyle = customAssertions . assertHoverLabelStyle ;
19
19
var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
20
+ var assertElemRightTo = customAssertions . assertElemRightTo ;
21
+ var assertElemTopsAligned = customAssertions . assertElemTopsAligned ;
22
+ var assertElemInside = customAssertions . assertElemInside ;
20
23
21
24
describe ( 'hover info' , function ( ) {
22
25
'use strict' ;
@@ -1136,15 +1139,6 @@ describe('hover info', function() {
1136
1139
msgPrefixFmt + 'Primary text inside box' ) ;
1137
1140
assertElemInside ( nodes . secondaryText , nodes . secondaryBox ,
1138
1141
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
- }
1148
1142
}
1149
1143
1150
1144
function assertSecondaryRightToPrimaryBox ( nodes , msgPrefix ) {
@@ -1154,22 +1148,6 @@ describe('hover info', function() {
1154
1148
msgPrefixFmt + 'Secondary box right to primary box' ) ;
1155
1149
assertElemTopsAligned ( nodes . secondaryBox , nodes . primaryBox ,
1156
1150
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
- }
1173
1151
}
1174
1152
1175
1153
describe ( 'centered' , function ( ) {
0 commit comments