@@ -2631,11 +2631,9 @@ describe('Test axes', function() {
26312631
26322632 Plotly . plot ( gd , data )
26332633 . then ( function ( ) {
2634- initialSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
26352634 expect ( gd . _fullLayout . xaxis . _lastangle ) . toBe ( 30 ) ;
2636- } )
2637- . then ( function ( ) {
2638- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2635+
2636+ initialSize = previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
26392637 return Plotly . relayout ( gd , { 'yaxis.automargin' : true } ) ;
26402638 } )
26412639 . then ( function ( ) {
@@ -2644,9 +2642,8 @@ describe('Test axes', function() {
26442642 expect ( size . r ) . toBe ( previousSize . r ) ;
26452643 expect ( size . b ) . toBe ( previousSize . b ) ;
26462644 expect ( size . t ) . toBe ( previousSize . t ) ;
2647- } )
2648- . then ( function ( ) {
2649- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2645+
2646+ previousSize = Lib . extendDeep ( { } , size ) ;
26502647 return Plotly . relayout ( gd , { 'xaxis.automargin' : true } ) ;
26512648 } )
26522649 . then ( function ( ) {
@@ -2655,9 +2652,8 @@ describe('Test axes', function() {
26552652 expect ( size . r ) . toBe ( previousSize . r ) ;
26562653 expect ( size . b ) . toBeGreaterThan ( previousSize . b ) ;
26572654 expect ( size . t ) . toBe ( previousSize . t ) ;
2658- } )
2659- . then ( function ( ) {
2660- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2655+
2656+ previousSize = Lib . extendDeep ( { } , size ) ;
26612657 savedBottom = previousSize . b ;
26622658 return Plotly . relayout ( gd , { 'xaxis.tickangle' : 45 } ) ;
26632659 } )
@@ -2667,9 +2663,8 @@ describe('Test axes', function() {
26672663 expect ( size . r ) . toBe ( previousSize . r ) ;
26682664 expect ( size . b ) . toBeGreaterThan ( previousSize . b ) ;
26692665 expect ( size . t ) . toBe ( previousSize . t ) ;
2670- } )
2671- . then ( function ( ) {
2672- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2666+
2667+ previousSize = Lib . extendDeep ( { } , size ) ;
26732668 return Plotly . relayout ( gd , { 'xaxis.tickangle' : 30 } ) ;
26742669 } )
26752670 . then ( function ( ) {
@@ -2678,9 +2673,8 @@ describe('Test axes', function() {
26782673 expect ( size . r ) . toBe ( previousSize . r ) ;
26792674 expect ( size . b ) . toBe ( savedBottom ) ;
26802675 expect ( size . t ) . toBe ( previousSize . t ) ;
2681- } )
2682- . then ( function ( ) {
2683- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2676+
2677+ previousSize = Lib . extendDeep ( { } , size ) ;
26842678 return Plotly . relayout ( gd , { 'yaxis.ticklen' : 30 } ) ;
26852679 } )
26862680 . then ( function ( ) {
@@ -2689,17 +2683,15 @@ describe('Test axes', function() {
26892683 expect ( size . r ) . toBe ( previousSize . r ) ;
26902684 expect ( size . b ) . toBe ( previousSize . b ) ;
26912685 expect ( size . t ) . toBe ( previousSize . t ) ;
2692- } )
2693- . then ( function ( ) {
2694- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2686+
2687+ previousSize = Lib . extendDeep ( { } , size ) ;
26952688 return Plotly . relayout ( gd , { 'yaxis.titlefont.size' : 30 } ) ;
26962689 } )
26972690 . then ( function ( ) {
26982691 var size = gd . _fullLayout . _size ;
26992692 expect ( size ) . toEqual ( previousSize ) ;
2700- } )
2701- . then ( function ( ) {
2702- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2693+
2694+ previousSize = Lib . extendDeep ( { } , size ) ;
27032695 return Plotly . relayout ( gd , { 'yaxis.title' : 'hello' } ) ;
27042696 } )
27052697 . then ( function ( ) {
@@ -2708,42 +2700,38 @@ describe('Test axes', function() {
27082700 expect ( size . r ) . toBe ( previousSize . r ) ;
27092701 expect ( size . b ) . toBe ( previousSize . b ) ;
27102702 expect ( size . t ) . toBe ( previousSize . t ) ;
2711- } )
2712- . then ( function ( ) {
2713- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2714- return Plotly . relayout ( gd , { 'yaxis.anchor' : 'free' } ) ;
2703+
2704+ previousSize = Lib . extendDeep ( { } , size ) ;
2705+ return Plotly . relayout ( gd , { 'yaxis.anchor' : 'free' } ) ;
27152706 } )
27162707 . then ( function ( ) {
27172708 var size = gd . _fullLayout . _size ;
27182709 expect ( size . l ) . toBe ( previousSize . l ) ;
27192710 expect ( size . r ) . toBe ( previousSize . r ) ;
27202711 expect ( size . b ) . toBe ( previousSize . b ) ;
27212712 expect ( size . t ) . toBe ( previousSize . t ) ;
2722- } )
2723- . then ( function ( ) {
2724- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2725- return Plotly . relayout ( gd , { 'yaxis.position' : 0.1 } ) ;
2713+
2714+ previousSize = Lib . extendDeep ( { } , size ) ;
2715+ return Plotly . relayout ( gd , { 'yaxis.position' : 0.1 } ) ;
27262716 } )
27272717 . then ( function ( ) {
27282718 var size = gd . _fullLayout . _size ;
27292719 expect ( size . l ) . toBeLessThan ( previousSize . l , 'axis moved right' ) ;
27302720 expect ( size . r ) . toBe ( previousSize . r ) ;
27312721 expect ( size . b ) . toBe ( previousSize . b ) ;
27322722 expect ( size . t ) . toBe ( previousSize . t ) ;
2733- } )
2734- . then ( function ( ) {
2735- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2736- return Plotly . relayout ( gd , { 'yaxis.anchor' : 'x' } ) ;
2723+
2724+ previousSize = Lib . extendDeep ( { } , size ) ;
2725+ return Plotly . relayout ( gd , { 'yaxis.anchor' : 'x' } ) ;
27372726 } )
27382727 . then ( function ( ) {
27392728 var size = gd . _fullLayout . _size ;
27402729 expect ( size . l ) . toBeGreaterThan ( previousSize . l , 'axis snapped back' ) ;
27412730 expect ( size . r ) . toBe ( previousSize . r ) ;
27422731 expect ( size . b ) . toBe ( previousSize . b ) ;
27432732 expect ( size . t ) . toBe ( previousSize . t ) ;
2744- } )
2745- . then ( function ( ) {
2746- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2733+
2734+ previousSize = Lib . extendDeep ( { } , size ) ;
27472735 return Plotly . relayout ( gd , {
27482736 'yaxis.side' : 'right' ,
27492737 'xaxis.side' : 'top'
@@ -2756,8 +2744,7 @@ describe('Test axes', function() {
27562744 expect ( size . r ) . toBe ( previousSize . l ) ;
27572745 expect ( size . b ) . toBe ( initialSize . b ) ;
27582746 expect ( size . t ) . toBe ( previousSize . b ) ;
2759- } )
2760- . then ( function ( ) {
2747+
27612748 return Plotly . relayout ( gd , {
27622749 'xaxis.automargin' : false ,
27632750 'yaxis.automargin' : false
0 commit comments