@@ -515,7 +515,7 @@ describe('Plotly.react transitions:', function() {
515
515
. then ( done ) ;
516
516
} ) ;
517
517
518
- it ( 'should only transition the layout when both traces and layout have animatable changes' , function ( done ) {
518
+ it ( 'should only transition the layout when both traces and layout have animatable changes by default ' , function ( done ) {
519
519
var data = [ { y : [ 1 , 2 , 1 ] } ] ;
520
520
var layout = {
521
521
transition : { duration : 10 } ,
@@ -566,12 +566,32 @@ describe('Plotly.react transitions:', function() {
566
566
[ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
567
567
// one instantaneous transition options to halt
568
568
// other trace transitions (if any)
569
- [ gd , null , { duration : 0 , easing : 'cubic-in-out' } , 'function' ] ,
569
+ [ gd , null , { duration : 0 , easing : 'cubic-in-out' , ordering : 'layout first' } , 'function' ] ,
570
570
// one _module.plot call from the relayout at end of axis transition
571
571
[ gd ]
572
572
] ] ,
573
573
] ) ;
574
574
} )
575
+ . then ( function ( ) {
576
+ data [ 0 ] . marker . color = 'red' ;
577
+ layout . xaxis . range = [ - 2 , 2 ] ;
578
+ layout . transition . ordering = 'traces first' ;
579
+ return Plotly . react ( gd , data , layout ) ;
580
+ } )
581
+ . then ( delay ( 20 ) )
582
+ . then ( function ( ) {
583
+ assertSpies ( 'both trace and layout transitions under *ordering:traces first*' , [
584
+ [ Plots , 'transitionFromReact' , 1 ] ,
585
+ [ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
586
+ // one smooth transition
587
+ [ gd , [ 0 ] , { duration : 10 , easing : 'cubic-in-out' , ordering : 'traces first' } , 'function' ] ,
588
+ // one by relayout call at the end of instantaneous axis transition
589
+ [ gd ]
590
+ ] ] ,
591
+ [ gd . _fullLayout . _basePlotModules [ 0 ] , 'transitionAxes' , 1 ] ,
592
+ [ Registry , 'call' , [ [ 'relayout' , gd , { 'xaxis.range' : [ - 2 , 2 ] } ] ] ]
593
+ ] ) ;
594
+ } )
575
595
. catch ( failTest )
576
596
. then ( done ) ;
577
597
} ) ;
@@ -674,7 +694,7 @@ describe('Plotly.react transitions:', function() {
674
694
[ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
675
695
// one instantaneous transition options to halt
676
696
// other trace transitions (if any)
677
- [ gd , null , { duration : 0 , easing : 'cubic-in-out' } , 'function' ] ,
697
+ [ gd , null , { duration : 0 , easing : 'cubic-in-out' , ordering : 'layout first' } , 'function' ] ,
678
698
// one _module.plot call from the relayout at end of axis transition
679
699
[ gd ]
680
700
] ] ,
@@ -690,8 +710,8 @@ describe('Plotly.react transitions:', function() {
690
710
[ Plots , 'transitionFromReact' , 1 ] ,
691
711
[ gd . _fullLayout . _basePlotModules [ 0 ] , 'transitionAxes' , 0 ] ,
692
712
[ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
693
- [ gd , [ 0 ] , { duration : 10 , easing : 'cubic-in-out' } , 'function' ] ,
694
713
// called from Plots.transitionFromReact
714
+ [ gd , [ 0 ] , { duration : 10 , easing : 'cubic-in-out' , ordering : 'layout first' } , 'function' ] ,
695
715
] ] ,
696
716
] ) ;
697
717
assertAxAutorange ( 'axes are still autorange:false' , false ) ;
@@ -762,7 +782,7 @@ describe('Plotly.react transitions:', function() {
762
782
[ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
763
783
// one instantaneous transition options to halt
764
784
// other trace transitions (if any)
765
- [ gd , null , { duration : 0 , easing : 'cubic-in-out' } , 'function' ] ,
785
+ [ gd , null , { duration : 0 , easing : 'cubic-in-out' , ordering : 'layout first' } , 'function' ] ,
766
786
// one _module.plot call from the relayout at end of axis transition
767
787
[ gd ]
768
788
] ]
0 commit comments