File tree 1 file changed +57
-0
lines changed
1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -458,3 +458,60 @@ describe('Test animate API', function() {
458
458
} ) ;
459
459
} ) ;
460
460
} ) ;
461
+
462
+ describe ( 'animation with non-mocked transitions' , function ( ) {
463
+ 'use strict' ;
464
+
465
+ var gd , mockCopy ;
466
+
467
+ beforeEach ( function ( done ) {
468
+ gd = createGraphDiv ( ) ;
469
+
470
+ mockCopy = Lib . extendDeep ( { } , mock ) ;
471
+
472
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
473
+ Plotly . addFrames ( gd , mockCopy . frames ) ;
474
+ } ) . then ( done ) ;
475
+ } ) ;
476
+
477
+ afterEach ( function ( ) {
478
+ // *must* purge between tests otherwise dangling async events might not get cleaned up properly:
479
+ Plotly . purge ( gd ) ;
480
+ destroyGraphDiv ( ) ;
481
+ } ) ;
482
+
483
+ it ( 'animates a transform' , function ( done ) {
484
+ Plotly . restyle ( gd , {
485
+ 'transforms[0]' : {
486
+ enabled : true ,
487
+ type : 'filter' ,
488
+ operation : '<' ,
489
+ filtersrc : 'x' ,
490
+ value : 10
491
+ }
492
+ } , [ 0 ] ) . then ( function ( ) {
493
+ expect ( gd . _fullData [ 0 ] . transforms ) . toEqual ( [ {
494
+ enabled : true ,
495
+ type : 'filter' ,
496
+ operation : '<' ,
497
+ filtersrc : 'x' ,
498
+ value : 10
499
+ } ] ) ;
500
+
501
+ return Plotly . animate ( gd , [ {
502
+ data : [ { 'transforms[0].operation' : '>' } ]
503
+ } ] , {
504
+ frame : { redraw : true , duration : 100 } ,
505
+ transition : { duration : 100 }
506
+ } ) ;
507
+ } ) . then ( function ( ) {
508
+ expect ( gd . _fullData [ 0 ] . transforms ) . toEqual ( [ {
509
+ enabled : true ,
510
+ type : 'filter' ,
511
+ operation : '>' ,
512
+ filtersrc : 'x' ,
513
+ value : 10
514
+ } ] ) ;
515
+ } ) . catch ( fail ) . then ( done ) ;
516
+ } ) ;
517
+ } ) ;
You can’t perform that action at this time.
0 commit comments