@@ -2057,6 +2057,7 @@ describe('hover on fill', function() {
20572057
20582058describe ( 'Hover on multicategory axes' , function ( ) {
20592059 var gd ;
2060+ var eventData ;
20602061
20612062 beforeEach ( function ( ) {
20622063 gd = createGraphDiv ( ) ;
@@ -2080,9 +2081,15 @@ describe('Hover on multicategory axes', function() {
20802081 width : 400 ,
20812082 height : 400
20822083 } )
2084+ . then ( function ( ) {
2085+ gd . on ( 'plotly_hover' , function ( d ) {
2086+ eventData = d . points [ 0 ] ;
2087+ } ) ;
2088+ } )
20832089 . then ( function ( ) { _hover ( 200 , 200 ) ; } )
20842090 . then ( function ( ) {
20852091 assertHoverLabelContent ( { nums : '−1' , axis : '2019 - a' } ) ;
2092+ expect ( eventData . x ) . toEqual ( [ '2019' , 'a' ] ) ;
20862093 } )
20872094 . then ( function ( ) {
20882095 return Plotly . update ( gd ,
@@ -2093,6 +2100,7 @@ describe('Hover on multicategory axes', function() {
20932100 . then ( function ( ) { _hover ( 140 , 200 ) ; } )
20942101 . then ( function ( ) {
20952102 assertHoverLabelContent ( { nums : 'Sample: b\nYear: 2018' } ) ;
2103+ expect ( eventData . x ) . toEqual ( [ '2018' , 'b' ] ) ;
20962104 } )
20972105 . catch ( failTest )
20982106 . then ( done ) ;
@@ -2105,11 +2113,17 @@ describe('Hover on multicategory axes', function() {
21052113 fig . layout . height = 500 ;
21062114
21072115 Plotly . plot ( gd , fig )
2116+ . then ( function ( ) {
2117+ gd . on ( 'plotly_hover' , function ( d ) {
2118+ eventData = d . points [ 0 ] ;
2119+ } ) ;
2120+ } )
21082121 . then ( function ( ) { _hover ( 200 , 200 ) ; } )
21092122 . then ( function ( ) {
21102123 assertHoverLabelContent ( {
21112124 nums : 'x: 2017 - q3\ny: Group 3 - A\nz: 2.303'
21122125 } ) ;
2126+ expect ( eventData . x ) . toEqual ( [ '2017' , 'q3' ] ) ;
21132127 } )
21142128 . catch ( failTest )
21152129 . then ( done ) ;
0 commit comments