@@ -162,7 +162,7 @@ describe('hoveranywhere', () => {
162162 it ( 'reports cursor position in top-level xPixel/yPixel, and point position in point-level xPixel/yPixel' , ( done ) => {
163163 var hoverData ;
164164
165- makePlot ( gd , { hoveranywhere : true } )
165+ makePlot ( gd , { } , { hoveranywhere : true } )
166166 . then ( ( ) => {
167167 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
168168
@@ -181,13 +181,25 @@ describe('hoveranywhere', () => {
181181 } ) ;
182182
183183 it ( 'respects hovermode:false' , ( done ) => {
184- var hoverData ;
184+ var events = [ ] ;
185+ var hoverData , unhoverData ;
185186
186187 makePlot ( gd , { } , { hoveranywhere : true , hovermode : false } )
187188 . then ( ( ) => {
189+ gd . on ( 'plotly_hover' , ( ) => {
190+ events . push ( 'hover' ) ;
191+ hoverData = d ;
192+ } ) ;
193+ gd . on ( 'plotly_unhover' , ( d ) => {
194+ events . push ( 'unhover' ) ;
195+ unhoverData = d ;
196+ } ) ;
188197 gd . on ( 'plotly_hover' , ( d ) => ( hoverData = d ) ) ;
189198 _hover ( 250 , 50 ) ;
199+ _leavePlotArea ( ) ;
190200 expect ( hoverData ) . toBeUndefined ( ) ;
201+ expect ( unhoverData ) . toBeUndefined ( ) ;
202+ expect ( events ) . toEqual ( [ ] ) ;
191203 } )
192204 . then ( done , done . fail ) ;
193205 } ) ;
@@ -196,7 +208,7 @@ describe('hoveranywhere', () => {
196208 var events = [ ] ;
197209 var unhoverData ;
198210
199- makePlot ( gd , { hoveranywhere : true } )
211+ makePlot ( gd , { } , { hoveranywhere : true } )
200212 . then ( ( ) => {
201213 gd . on ( 'plotly_hover' , ( ) => events . push ( 'hover' ) ) ;
202214 gd . on ( 'plotly_unhover' , ( d ) => {
@@ -218,7 +230,7 @@ describe('hoveranywhere', () => {
218230 it ( 'emits only one unhover per departure from the plot area' , ( done ) => {
219231 var events = [ ] ;
220232
221- makePlot ( gd , { hoveranywhere : true } )
233+ makePlot ( gd , { } , { hoveranywhere : true } )
222234 . then ( ( ) => {
223235 gd . on ( 'plotly_unhover' , ( ) => events . push ( 'unhover' ) ) ;
224236
@@ -234,7 +246,7 @@ describe('hoveranywhere', () => {
234246 it ( 'does not emit unhover while moving within empty space' , ( done ) => {
235247 var events = [ ] ;
236248
237- makePlot ( gd , { hoveranywhere : true } )
249+ makePlot ( gd , { } , { hoveranywhere : true } )
238250 . then ( ( ) => {
239251 gd . on ( 'plotly_hover' , ( ) => events . push ( 'hover' ) ) ;
240252 gd . on ( 'plotly_unhover' , ( ) => events . push ( 'unhover' ) ) ;
@@ -252,7 +264,7 @@ describe('hoveranywhere', () => {
252264 var events = [ ] ;
253265 var unhoverData ;
254266
255- makePlot ( gd , { hoveranywhere : true } )
267+ makePlot ( gd , { } , { hoveranywhere : true } )
256268 . then ( ( ) => {
257269 gd . on ( 'plotly_unhover' , ( d ) => {
258270 events . push ( 'unhover' ) ;
0 commit comments