@@ -444,7 +444,53 @@ describe('hover info', function() {
444444
445445 done ( ) ;
446446 } ) ;
447+ } ) ;
448+ } ) ;
449+
450+ describe ( '\'hover info for x/y/z traces' , function ( ) {
451+ function _hover ( gd , xpx , ypx ) {
452+ Fx . hover ( gd , { xpx : xpx , ypx : ypx } , 'xy' ) ;
453+ delete gd . _lastHoverTime ;
454+ }
455+
456+ function _assert ( nameLabel , lines ) {
457+ expect ( d3 . select ( 'g.axistext' ) . size ( ) ) . toEqual ( 0 , 'no common label' ) ;
458+
459+ var sel = d3 . select ( 'g.hovertext' ) ;
460+ expect ( sel . select ( 'text.name' ) . html ( ) ) . toEqual ( nameLabel , 'name label' ) ;
461+ sel . select ( 'text.nums' ) . selectAll ( 'tspan' ) . each ( function ( _ , i ) {
462+ expect ( d3 . select ( this ) . html ( ) ) . toEqual ( lines [ i ] , 'lines ' + i ) ;
463+ } ) ;
464+ }
447465
466+ it ( 'should display correct label content' , function ( done ) {
467+ var gd = createGraphDiv ( ) ;
468+
469+ Plotly . plot ( gd , [ {
470+ type : 'heatmap' ,
471+ y : [ 0 , 1 ] ,
472+ z : [ [ 1 , 2 , 3 ] , [ 2 , 2 , 1 ] ] ,
473+ name : 'one' ,
474+ } , {
475+ type : 'heatmap' ,
476+ y : [ 2 , 3 ] ,
477+ z : [ [ 1 , 2 , 3 ] , [ 2 , 2 , 1 ] ] ,
478+ name : 'two'
479+ } ] , {
480+ width : 500 ,
481+ height : 400 ,
482+ margin : { l : 0 , t : 0 , r : 0 , b : 0 }
483+ } )
484+ . then ( function ( ) {
485+ _hover ( gd , 250 , 100 ) ;
486+ _assert ( 'two' , [ 'x: 1' , 'y: 3' , 'z: 2' ] ) ;
487+ } )
488+ . then ( function ( ) {
489+ _hover ( gd , 250 , 300 ) ;
490+ _assert ( 'one' , [ 'x: 1' , 'y: 1' , 'z: 2' ] ) ;
491+ } )
492+ . catch ( fail )
493+ . then ( done ) ;
448494 } ) ;
449495 } ) ;
450496
0 commit comments