@@ -260,6 +260,12 @@ describe('sankey tests', function() {
260
260
261
261
afterEach ( destroyGraphDiv ) ;
262
262
263
+ function wait ( ) {
264
+ return new Promise ( function ( resolve ) {
265
+ setTimeout ( resolve , 60 ) ;
266
+ } ) ;
267
+ }
268
+
263
269
it ( 'Plotly.deleteTraces with two traces removes the deleted plot' , function ( done ) {
264
270
265
271
var gd = createGraphDiv ( ) ;
@@ -313,30 +319,23 @@ describe('sankey tests', function() {
313
319
} ) ;
314
320
315
321
it ( 'Plotly.plot shows and removes tooltip on node, link' , function ( done ) {
316
-
317
322
var gd = createGraphDiv ( ) ;
318
323
var mockCopy = Lib . extendDeep ( { } , mock ) ;
319
324
320
- Plotly . plot ( gd , mockCopy )
321
- . then ( function ( ) {
322
-
323
- mouseEvent ( 'mousemove' , 400 , 300 ) ;
324
- mouseEvent ( 'mouseover' , 400 , 300 ) ;
325
-
326
- window . setTimeout ( function ( ) {
327
- expect ( d3 . select ( '.hoverlayer>.hovertext>text' ) . node ( ) . innerHTML )
328
- . toEqual ( '447TWh' , 'tooltip present' ) ;
329
-
330
- mouseEvent ( 'mousemove' , 450 , 300 ) ;
331
- mouseEvent ( 'mouseover' , 450 , 300 ) ;
332
-
333
- window . setTimeout ( function ( ) {
334
- expect ( d3 . select ( '.hoverlayer>.hovertext>text' ) . node ( ) . innerHTML )
335
- . toEqual ( '46TWh' , 'tooltip jumped to link' ) ;
336
- done ( ) ;
337
- } , 60 ) ;
338
- } , 60 ) ;
339
- } ) ;
325
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
326
+ mouseEvent ( 'mousemove' , 400 , 300 ) ;
327
+ mouseEvent ( 'mouseover' , 400 , 300 ) ;
328
+ } )
329
+ . then ( wait )
330
+ . then ( function ( ) {
331
+ expect ( d3 . select ( '.hoverlayer>.hovertext>text' ) . node ( ) . innerHTML )
332
+ . toEqual ( '447TWh' , 'tooltip present' ) ;
333
+ } )
334
+ . then ( function ( ) {
335
+ mouseEvent ( 'mousemove' , 450 , 300 ) ;
336
+ mouseEvent ( 'mouseover' , 450 , 300 ) ;
337
+ } )
338
+ . then ( done ) ;
340
339
} ) ;
341
340
} ) ;
342
341
} ) ;
0 commit comments