@@ -1188,7 +1188,7 @@ describe('hover info', function() {
11881188 } ) ;
11891189 } )
11901190 . then ( done , done . fail ) ;
1191- } ) ;
1191+ } ) ;
11921192
11931193 it ( 'will show a category range if you ask nicely' , function ( done ) {
11941194 var gd = createGraphDiv ( ) ;
@@ -1217,6 +1217,41 @@ describe('hover info', function() {
12171217 } )
12181218 . then ( done , done . fail ) ;
12191219 } ) ;
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+ } ) ;
12201255 } ) ;
12211256
12221257 [ 'candlestick' , 'ohlc' ] . forEach ( function ( type ) {
0 commit comments