@@ -2057,6 +2057,7 @@ describe('hover on fill', function() {
2057
2057
2058
2058
describe ( 'Hover on multicategory axes' , function ( ) {
2059
2059
var gd ;
2060
+ var eventData ;
2060
2061
2061
2062
beforeEach ( function ( ) {
2062
2063
gd = createGraphDiv ( ) ;
@@ -2080,9 +2081,15 @@ describe('Hover on multicategory axes', function() {
2080
2081
width : 400 ,
2081
2082
height : 400
2082
2083
} )
2084
+ . then ( function ( ) {
2085
+ gd . on ( 'plotly_hover' , function ( d ) {
2086
+ eventData = d . points [ 0 ] ;
2087
+ } ) ;
2088
+ } )
2083
2089
. then ( function ( ) { _hover ( 200 , 200 ) ; } )
2084
2090
. then ( function ( ) {
2085
2091
assertHoverLabelContent ( { nums : '−1' , axis : '2019 - a' } ) ;
2092
+ expect ( eventData . x ) . toEqual ( [ '2019' , 'a' ] ) ;
2086
2093
} )
2087
2094
. then ( function ( ) {
2088
2095
return Plotly . update ( gd ,
@@ -2093,6 +2100,7 @@ describe('Hover on multicategory axes', function() {
2093
2100
. then ( function ( ) { _hover ( 140 , 200 ) ; } )
2094
2101
. then ( function ( ) {
2095
2102
assertHoverLabelContent ( { nums : 'Sample: b\nYear: 2018' } ) ;
2103
+ expect ( eventData . x ) . toEqual ( [ '2018' , 'b' ] ) ;
2096
2104
} )
2097
2105
. catch ( failTest )
2098
2106
. then ( done ) ;
@@ -2105,11 +2113,17 @@ describe('Hover on multicategory axes', function() {
2105
2113
fig . layout . height = 500 ;
2106
2114
2107
2115
Plotly . plot ( gd , fig )
2116
+ . then ( function ( ) {
2117
+ gd . on ( 'plotly_hover' , function ( d ) {
2118
+ eventData = d . points [ 0 ] ;
2119
+ } ) ;
2120
+ } )
2108
2121
. then ( function ( ) { _hover ( 200 , 200 ) ; } )
2109
2122
. then ( function ( ) {
2110
2123
assertHoverLabelContent ( {
2111
2124
nums : 'x: 2017 - q3\ny: Group 3 - A\nz: 2.303'
2112
2125
} ) ;
2126
+ expect ( eventData . x ) . toEqual ( [ '2017' , 'q3' ] ) ;
2113
2127
} )
2114
2128
. catch ( failTest )
2115
2129
. then ( done ) ;
0 commit comments