@@ -1257,6 +1257,13 @@ describe('waterfall hover', function() {
1257
1257
expect ( out . style ) . toEqual ( [ 0 , '#3D9970' , 0 , 13.23 ] ) ;
1258
1258
assertPos ( out . pos , [ 11.87 , 59.33 , 52.71 , 52.71 ] ) ;
1259
1259
} ) ;
1260
+
1261
+ it ( 'should return the correct hover point data (case closest - decreasing case)' , function ( ) {
1262
+ var out = _hover ( gd , 0.8 , 4 , 'closest' ) ;
1263
+
1264
+ expect ( out . style ) . toBeCloseToArray ( [ 1 , '#FF4136' , 1 , - 9.47 ] ) ;
1265
+ assertPos ( out . pos , [ 137 , 181 , 266 , 266 ] ) ;
1266
+ } ) ;
1260
1267
} ) ;
1261
1268
1262
1269
describe ( 'text labels' , function ( ) {
@@ -1371,6 +1378,7 @@ describe('waterfall hover', function() {
1371
1378
[ - 3.9 , 1 , 'closest' ] ,
1372
1379
[ 5.9 , 1.9 , 'closest' ] ,
1373
1380
[ - 3.9 , - 10 , 'x' ] ,
1381
+ [ 1 , 2.1 , 'closest' ] ,
1374
1382
[ 5.9 , 19 , 'x' ]
1375
1383
] . forEach ( function ( hoverSpec ) {
1376
1384
var out = _hover ( gd , hoverSpec [ 0 ] , hoverSpec [ 1 ] , hoverSpec [ 2 ] ) ;
@@ -1382,7 +1390,6 @@ describe('waterfall hover', function() {
1382
1390
// then a few that are off the edge so yield nothing
1383
1391
[
1384
1392
[ 1 , - 0.1 , 'closest' ] ,
1385
- [ 1 , 2.1 , 'closest' ] ,
1386
1393
[ - 4.1 , 1 , 'closest' ] ,
1387
1394
[ 6.1 , 1 , 'closest' ] ,
1388
1395
[ - 4.1 , 1 , 'x' ] ,
0 commit comments