@@ -2136,15 +2136,17 @@ describe('bar hover', function() {
21362136
21372137 afterEach ( destroyGraphDiv ) ;
21382138
2139- function getPointData ( gd ) {
2139+ function getPointData ( gd , curveNumber ) {
2140+ curveNumber = curveNumber || 0 ;
2141+
21402142 var cd = gd . calcdata ;
21412143 var subplot = gd . _fullLayout . _plots . xy ;
21422144
21432145 return {
21442146 index : false ,
21452147 distance : 20 ,
2146- cd : cd [ 0 ] ,
2147- trace : cd [ 0 ] [ 0 ] . trace ,
2148+ cd : cd [ curveNumber ] ,
2149+ trace : cd [ curveNumber ] [ 0 ] . trace ,
21482150 xa : subplot . xaxis ,
21492151 ya : subplot . yaxis ,
21502152 maxHoverDistance : 20
@@ -2421,7 +2423,34 @@ describe('bar hover', function() {
24212423 } ) ;
24222424 } ) ;
24232425
2424-
2426+ describe ( 'should include info of height=0 bars on hover' , function ( ) {
2427+ var modes = [ 'stack' , 'overlay' , 'group' ] ;
2428+
2429+ modes . forEach ( function ( m ) {
2430+ it ( '- under barmode:' + m , function ( done ) {
2431+ gd = createGraphDiv ( ) ;
2432+
2433+ Plotly . plot ( gd , [ {
2434+ type : 'bar' ,
2435+ y : [ 0 , 1 , 0 ]
2436+ } , {
2437+ type : 'bar' ,
2438+ y : [ 1 , 0 , 1 ]
2439+ } ] , {
2440+ barmode : m
2441+ } )
2442+ . then ( function ( ) {
2443+ var pt0 = Bar . hoverPoints ( getPointData ( gd , 0 ) , 0 , 1 , 'x' ) [ 0 ] ;
2444+ var pt1 = Bar . hoverPoints ( getPointData ( gd , 1 ) , 0 , 1 , 'x' ) [ 0 ] ;
2445+
2446+ expect ( pt0 . yLabelVal ) . toBe ( 0 , 'y label value for data[0]' ) ;
2447+ expect ( pt1 . yLabelVal ) . toBe ( 1 , 'y label value for data[1]' ) ;
2448+ } )
2449+ . catch ( failTest )
2450+ . then ( done ) ;
2451+ } ) ;
2452+ } ) ;
2453+ } ) ;
24252454} ) ;
24262455
24272456describe ( 'event data' , function ( ) {
0 commit comments