@@ -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 ) {
@@ -275,6 +275,7 @@ describe('Test sort transform interactions:', function() {
275
275
function hover ( gd , id ) {
276
276
return new Promise ( function ( resolve ) {
277
277
gd . once ( 'plotly_hover' , function ( eventData ) {
278
+ delete gd . _lastHoverTime ;
278
279
resolve ( eventData ) ;
279
280
} ) ;
280
281
@@ -283,25 +284,6 @@ describe('Test sort transform interactions:', function() {
283
284
} ) ;
284
285
}
285
286
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
-
299
- function wait ( ) {
300
- return new Promise ( function ( resolve ) {
301
- setTimeout ( resolve , 100 ) ;
302
- } ) ;
303
- }
304
-
305
287
function assertPt ( eventData , x , y , pointNumber , id ) {
306
288
var pt = eventData . points [ 0 ] ;
307
289
@@ -334,21 +316,18 @@ describe('Test sort transform interactions:', function() {
334
316
. then ( function ( eventData ) {
335
317
assertPt ( eventData , 0 , 1 , 3 , 'D' ) ;
336
318
} )
337
- . then ( wait )
338
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
319
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
339
320
. then ( function ( eventData ) {
340
321
assertPt ( eventData , 1 , 1 , 6 , 'G' ) ;
341
322
} )
342
- . then ( wait )
343
323
. then ( function ( ) {
344
324
return Plotly . restyle ( gd , 'transforms[0].enabled' , true ) ;
345
325
} )
346
326
. then ( function ( ) { return hover ( gd , 'D' ) ; } )
347
327
. then ( function ( eventData ) {
348
328
assertPt ( eventData , 0 , 1 , 1 , 'D' ) ;
349
329
} )
350
- . then ( wait )
351
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
330
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
352
331
. then ( function ( eventData ) {
353
332
assertPt ( eventData , 1 , 1 , 5 , 'G' ) ;
354
333
} )
@@ -359,8 +338,7 @@ describe('Test sort transform interactions:', function() {
359
338
. then ( function ( eventData ) {
360
339
assertPt ( eventData , 0 , 1 , 1 , 'D' ) ;
361
340
} )
362
- . then ( wait )
363
- . then ( function ( ) { return click ( gd , 'G' ) ; } )
341
+ . then ( function ( ) { return hover ( gd , 'G' ) ; } )
364
342
. then ( function ( eventData ) {
365
343
assertPt ( eventData , 1 , 1 , 5 , 'G' ) ;
366
344
} )
0 commit comments