@@ -515,7 +515,7 @@ describe('Plotly.react transitions:', function() {
515515 . then ( done ) ;
516516 } ) ;
517517
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 ) {
519519 var data = [ { y : [ 1 , 2 , 1 ] } ] ;
520520 var layout = {
521521 transition : { duration : 10 } ,
@@ -566,12 +566,32 @@ describe('Plotly.react transitions:', function() {
566566 [ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
567567 // one instantaneous transition options to halt
568568 // 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' ] ,
570570 // one _module.plot call from the relayout at end of axis transition
571571 [ gd ]
572572 ] ] ,
573573 ] ) ;
574574 } )
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+ } )
575595 . catch ( failTest )
576596 . then ( done ) ;
577597 } ) ;
@@ -674,7 +694,7 @@ describe('Plotly.react transitions:', function() {
674694 [ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
675695 // one instantaneous transition options to halt
676696 // 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' ] ,
678698 // one _module.plot call from the relayout at end of axis transition
679699 [ gd ]
680700 ] ] ,
@@ -690,8 +710,8 @@ describe('Plotly.react transitions:', function() {
690710 [ Plots , 'transitionFromReact' , 1 ] ,
691711 [ gd . _fullLayout . _basePlotModules [ 0 ] , 'transitionAxes' , 0 ] ,
692712 [ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
693- [ gd , [ 0 ] , { duration : 10 , easing : 'cubic-in-out' } , 'function' ] ,
694713 // called from Plots.transitionFromReact
714+ [ gd , [ 0 ] , { duration : 10 , easing : 'cubic-in-out' , ordering : 'layout first' } , 'function' ] ,
695715 ] ] ,
696716 ] ) ;
697717 assertAxAutorange ( 'axes are still autorange:false' , false ) ;
@@ -762,7 +782,7 @@ describe('Plotly.react transitions:', function() {
762782 [ gd . _fullLayout . _basePlotModules [ 0 ] , 'plot' , [
763783 // one instantaneous transition options to halt
764784 // 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' ] ,
766786 // one _module.plot call from the relayout at end of axis transition
767787 [ gd ]
768788 ] ]
0 commit comments