@@ -1188,7 +1188,7 @@ describe('hover info', function() {
1188
1188
} ) ;
1189
1189
} )
1190
1190
. then ( done , done . fail ) ;
1191
- } ) ;
1191
+ } ) ;
1192
1192
1193
1193
it ( 'will show a category range if you ask nicely' , function ( done ) {
1194
1194
var gd = createGraphDiv ( ) ;
@@ -1217,6 +1217,41 @@ describe('hover info', function() {
1217
1217
} )
1218
1218
. then ( done , done . fail ) ;
1219
1219
} ) ;
1220
+
1221
+ it ( 'will update when switching from one empty bin to another' , done => {
1222
+ const gd = createGraphDiv ( ) ;
1223
+
1224
+ Plotly
1225
+ . newPlot (
1226
+ gd ,
1227
+ [ {
1228
+ x : [
1229
+ 0.025 , 0.025 , 0.025 , 0.025 , 0.025 ,
1230
+ 0.075 , 0.075 , 0.075 , 0.075 , 0.075 ,
1231
+ 0.125 , 0.125 , 0.125 , 0.125 , 0.125 , 0.125 ,
1232
+ 0.175 , 0.175 , 0.175 , 0.175 ,
1233
+ 0.475 , 0.475 , 0.475
1234
+ ] ,
1235
+ xbins : { start : 0 , end : 0.5 , size : 0.10 } ,
1236
+ type : 'histogram'
1237
+ } ] ,
1238
+ {
1239
+ hovermode : 'x' ,
1240
+ width : 500 ,
1241
+ height : 400 ,
1242
+ margin : { l : 0 , t : 0 , r : 0 , b : 0 }
1243
+ }
1244
+ )
1245
+ . then ( ( ) => {
1246
+ let hoverData ;
1247
+ gd . on ( 'plotly_hover' , e => { hoverData = e ; } ) ;
1248
+ _hoverNatural ( gd , 250 , 200 ) ;
1249
+ expect ( hoverData . points [ 0 ] . binNumber ) . toBe ( 2 )
1250
+ _hoverNatural ( gd , 300 , 200 ) ;
1251
+ expect ( hoverData . points [ 0 ] . binNumber ) . toBe ( 3 )
1252
+ } )
1253
+ . then ( done , done . fail ) ;
1254
+ } ) ;
1220
1255
} ) ;
1221
1256
1222
1257
[ 'candlestick' , 'ohlc' ] . forEach ( function ( type ) {
0 commit comments