@@ -463,6 +463,16 @@ describe('hover info', function() {
463463 Lib . clearThrottle ( ) ;
464464 }
465465
466+ function _hoverNatural ( gd , xpx , ypx ) {
467+ var gdBB = gd . getBoundingClientRect ( ) ;
468+ var dragger = gd . querySelector ( '.nsewdrag' ) ;
469+ var clientX = xpx + gdBB . left + gd . _fullLayout . _size . l ;
470+ var clientY = ypx + gdBB . top + gd . _fullLayout . _size . t ;
471+
472+ Fx . hover ( gd , { clientX : clientX , clientY : clientY , target : dragger } , 'xy' ) ;
473+ Lib . clearThrottle ( ) ;
474+ }
475+
466476 describe ( '\'hover info for x/y/z traces' , function ( ) {
467477 it ( 'should display correct label content' , function ( done ) {
468478 var gd = createGraphDiv ( ) ;
@@ -526,6 +536,7 @@ describe('hover info', function() {
526536 describe ( 'histogram hover info' , function ( ) {
527537 it ( 'shows the data range when bins have multiple values' , function ( done ) {
528538 var gd = createGraphDiv ( ) ;
539+ var pts ;
529540
530541 Plotly . plot ( gd , [ {
531542 x : [ 0 , 2 , 3 , 4 , 5 , 6 , 7 ] ,
@@ -537,12 +548,28 @@ describe('hover info', function() {
537548 margin : { l : 0 , t : 0 , r : 0 , b : 0 }
538549 } )
539550 . then ( function ( ) {
540- _hover ( gd , 250 , 200 ) ;
551+ gd . on ( 'plotly_hover' , function ( e ) { pts = e . points ; } ) ;
552+
553+ _hoverNatural ( gd , 250 , 200 ) ;
541554 assertHoverLabelContent ( {
542555 nums : '3' ,
543556 axis : '3 - 5'
544557 } ) ;
545558 } )
559+ . then ( function ( ) {
560+ expect ( pts . length ) . toBe ( 1 ) ;
561+ var pt = pts [ 0 ] ;
562+
563+ expect ( pt . curveNumber ) . toBe ( 0 ) ;
564+ expect ( pt . binNumber ) . toBe ( 1 ) ;
565+ expect ( pt . pointNumbers ) . toEqual ( [ 2 , 3 , 4 ] ) ;
566+ expect ( pt . x ) . toBe ( 4 ) ;
567+ expect ( pt . y ) . toBe ( 3 ) ;
568+ expect ( pt . data ) . toBe ( gd . data [ 0 ] ) ;
569+ expect ( pt . fullData ) . toBe ( gd . _fullData [ 0 ] ) ;
570+ expect ( pt . xaxis ) . toBe ( gd . _fullLayout . xaxis ) ;
571+ expect ( pt . yaxis ) . toBe ( gd . _fullLayout . yaxis ) ;
572+ } )
546573 . catch ( fail )
547574 . then ( done ) ;
548575 } ) ;
0 commit comments