@@ -258,7 +258,7 @@ describe('Test sort transform interactions:', function() {
258
258
. then ( done ) ;
259
259
} ) ;
260
260
261
- it ( 'does not preserve hover/click `pointNumber` value' , function ( done ) {
261
+ it ( 'does not preserve event data `pointNumber` value' , function ( done ) {
262
262
var gd = createGraphDiv ( ) ;
263
263
264
264
function getPxPos ( gd , id ) {
@@ -273,32 +273,18 @@ describe('Test sort transform interactions:', function() {
273
273
}
274
274
275
275
function hover ( gd , id ) {
276
- return new Promise ( function ( resolve ) {
276
+ return new Promise ( function ( resolve , reject ) {
277
277
gd . once ( 'plotly_hover' , function ( eventData ) {
278
+ delete gd . _lastHoverTime ;
278
279
resolve ( eventData ) ;
279
280
} ) ;
280
281
281
282
var pos = getPxPos ( gd , id ) ;
282
283
mouseEvent ( 'mousemove' , pos [ 0 ] , pos [ 1 ] ) ;
283
- } ) ;
284
- }
285
-
286
- function click ( gd , id ) {
287
- return new Promise ( function ( resolve ) {
288
- gd . once ( 'plotly_click' , function ( eventData ) {
289
- resolve ( eventData ) ;
290
- } ) ;
291
-
292
- var pos = getPxPos ( gd , id ) ;
293
- mouseEvent ( 'mousemove' , pos [ 0 ] , pos [ 1 ] ) ;
294
- mouseEvent ( 'mousedown' , pos [ 0 ] , pos [ 1 ] ) ;
295
- mouseEvent ( 'mouseup' , pos [ 0 ] , pos [ 1 ] ) ;
296
- } ) ;
297
- }
298
284
299
- function wait ( ) {
300
- return new Promise ( function ( resolve ) {
301
- setTimeout ( resolve , 100 ) ;
285
+ setTimeout ( function ( ) {
286
+ reject ( 'plotly_hover did not get called!' ) ;
287
+ } , 100 ) ;
302
288
} ) ;
303
289
}
304
290
@@ -334,21 +320,18 @@ describe('Test sort transform interactions:', function() {
334
320
. then ( function ( eventData ) {
335
321
assertPt ( eventData , 0 , 1 , 3 , 'D' ) ;
336
322
} )
337
- . then ( wait )
338
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
323
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
339
324
. then ( function ( eventData ) {
340
325
assertPt ( eventData , 1 , 1 , 6 , 'G' ) ;
341
326
} )
342
- . then ( wait )
343
327
. then ( function ( ) {
344
328
return Plotly . restyle ( gd , 'transforms[0].enabled' , true ) ;
345
329
} )
346
330
. then ( function ( ) { return hover ( gd , 'D' ) ; } )
347
331
. then ( function ( eventData ) {
348
332
assertPt ( eventData , 0 , 1 , 1 , 'D' ) ;
349
333
} )
350
- . then ( wait )
351
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
334
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
352
335
. then ( function ( eventData ) {
353
336
assertPt ( eventData , 1 , 1 , 5 , 'G' ) ;
354
337
} )
@@ -359,8 +342,7 @@ describe('Test sort transform interactions:', function() {
359
342
. then ( function ( eventData ) {
360
343
assertPt ( eventData , 0 , 1 , 1 , 'D' ) ;
361
344
} )
362
- . then ( wait )
363
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
345
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
364
346
. then ( function ( eventData ) {
365
347
assertPt ( eventData , 1 , 1 , 5 , 'G' ) ;
366
348
} )
0 commit comments