@@ -2136,15 +2136,17 @@ describe('bar hover', function() {
2136
2136
2137
2137
afterEach ( destroyGraphDiv ) ;
2138
2138
2139
- function getPointData ( gd ) {
2139
+ function getPointData ( gd , curveNumber ) {
2140
+ curveNumber = curveNumber || 0 ;
2141
+
2140
2142
var cd = gd . calcdata ;
2141
2143
var subplot = gd . _fullLayout . _plots . xy ;
2142
2144
2143
2145
return {
2144
2146
index : false ,
2145
2147
distance : 20 ,
2146
- cd : cd [ 0 ] ,
2147
- trace : cd [ 0 ] [ 0 ] . trace ,
2148
+ cd : cd [ curveNumber ] ,
2149
+ trace : cd [ curveNumber ] [ 0 ] . trace ,
2148
2150
xa : subplot . xaxis ,
2149
2151
ya : subplot . yaxis ,
2150
2152
maxHoverDistance : 20
@@ -2421,7 +2423,34 @@ describe('bar hover', function() {
2421
2423
} ) ;
2422
2424
} ) ;
2423
2425
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
+ } ) ;
2425
2454
} ) ;
2426
2455
2427
2456
describe ( 'event data' , function ( ) {
0 commit comments