@@ -2631,11 +2631,9 @@ describe('Test axes', function() {
2631
2631
2632
2632
Plotly . plot ( gd , data )
2633
2633
. then ( function ( ) {
2634
- initialSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2635
2634
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 ) ;
2639
2637
return Plotly . relayout ( gd , { 'yaxis.automargin' : true } ) ;
2640
2638
} )
2641
2639
. then ( function ( ) {
@@ -2644,9 +2642,8 @@ describe('Test axes', function() {
2644
2642
expect ( size . r ) . toBe ( previousSize . r ) ;
2645
2643
expect ( size . b ) . toBe ( previousSize . b ) ;
2646
2644
expect ( size . t ) . toBe ( previousSize . t ) ;
2647
- } )
2648
- . then ( function ( ) {
2649
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2645
+
2646
+ previousSize = Lib . extendDeep ( { } , size ) ;
2650
2647
return Plotly . relayout ( gd , { 'xaxis.automargin' : true } ) ;
2651
2648
} )
2652
2649
. then ( function ( ) {
@@ -2655,9 +2652,8 @@ describe('Test axes', function() {
2655
2652
expect ( size . r ) . toBe ( previousSize . r ) ;
2656
2653
expect ( size . b ) . toBeGreaterThan ( previousSize . b ) ;
2657
2654
expect ( size . t ) . toBe ( previousSize . t ) ;
2658
- } )
2659
- . then ( function ( ) {
2660
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2655
+
2656
+ previousSize = Lib . extendDeep ( { } , size ) ;
2661
2657
savedBottom = previousSize . b ;
2662
2658
return Plotly . relayout ( gd , { 'xaxis.tickangle' : 45 } ) ;
2663
2659
} )
@@ -2667,9 +2663,8 @@ describe('Test axes', function() {
2667
2663
expect ( size . r ) . toBe ( previousSize . r ) ;
2668
2664
expect ( size . b ) . toBeGreaterThan ( previousSize . b ) ;
2669
2665
expect ( size . t ) . toBe ( previousSize . t ) ;
2670
- } )
2671
- . then ( function ( ) {
2672
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2666
+
2667
+ previousSize = Lib . extendDeep ( { } , size ) ;
2673
2668
return Plotly . relayout ( gd , { 'xaxis.tickangle' : 30 } ) ;
2674
2669
} )
2675
2670
. then ( function ( ) {
@@ -2678,9 +2673,8 @@ describe('Test axes', function() {
2678
2673
expect ( size . r ) . toBe ( previousSize . r ) ;
2679
2674
expect ( size . b ) . toBe ( savedBottom ) ;
2680
2675
expect ( size . t ) . toBe ( previousSize . t ) ;
2681
- } )
2682
- . then ( function ( ) {
2683
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2676
+
2677
+ previousSize = Lib . extendDeep ( { } , size ) ;
2684
2678
return Plotly . relayout ( gd , { 'yaxis.ticklen' : 30 } ) ;
2685
2679
} )
2686
2680
. then ( function ( ) {
@@ -2689,17 +2683,15 @@ describe('Test axes', function() {
2689
2683
expect ( size . r ) . toBe ( previousSize . r ) ;
2690
2684
expect ( size . b ) . toBe ( previousSize . b ) ;
2691
2685
expect ( size . t ) . toBe ( previousSize . t ) ;
2692
- } )
2693
- . then ( function ( ) {
2694
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2686
+
2687
+ previousSize = Lib . extendDeep ( { } , size ) ;
2695
2688
return Plotly . relayout ( gd , { 'yaxis.titlefont.size' : 30 } ) ;
2696
2689
} )
2697
2690
. then ( function ( ) {
2698
2691
var size = gd . _fullLayout . _size ;
2699
2692
expect ( size ) . toEqual ( previousSize ) ;
2700
- } )
2701
- . then ( function ( ) {
2702
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2693
+
2694
+ previousSize = Lib . extendDeep ( { } , size ) ;
2703
2695
return Plotly . relayout ( gd , { 'yaxis.title' : 'hello' } ) ;
2704
2696
} )
2705
2697
. then ( function ( ) {
@@ -2708,42 +2700,38 @@ describe('Test axes', function() {
2708
2700
expect ( size . r ) . toBe ( previousSize . r ) ;
2709
2701
expect ( size . b ) . toBe ( previousSize . b ) ;
2710
2702
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' } ) ;
2715
2706
} )
2716
2707
. then ( function ( ) {
2717
2708
var size = gd . _fullLayout . _size ;
2718
2709
expect ( size . l ) . toBe ( previousSize . l ) ;
2719
2710
expect ( size . r ) . toBe ( previousSize . r ) ;
2720
2711
expect ( size . b ) . toBe ( previousSize . b ) ;
2721
2712
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 } ) ;
2726
2716
} )
2727
2717
. then ( function ( ) {
2728
2718
var size = gd . _fullLayout . _size ;
2729
2719
expect ( size . l ) . toBeLessThan ( previousSize . l , 'axis moved right' ) ;
2730
2720
expect ( size . r ) . toBe ( previousSize . r ) ;
2731
2721
expect ( size . b ) . toBe ( previousSize . b ) ;
2732
2722
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' } ) ;
2737
2726
} )
2738
2727
. then ( function ( ) {
2739
2728
var size = gd . _fullLayout . _size ;
2740
2729
expect ( size . l ) . toBeGreaterThan ( previousSize . l , 'axis snapped back' ) ;
2741
2730
expect ( size . r ) . toBe ( previousSize . r ) ;
2742
2731
expect ( size . b ) . toBe ( previousSize . b ) ;
2743
2732
expect ( size . t ) . toBe ( previousSize . t ) ;
2744
- } )
2745
- . then ( function ( ) {
2746
- previousSize = Lib . extendDeep ( { } , gd . _fullLayout . _size ) ;
2733
+
2734
+ previousSize = Lib . extendDeep ( { } , size ) ;
2747
2735
return Plotly . relayout ( gd , {
2748
2736
'yaxis.side' : 'right' ,
2749
2737
'xaxis.side' : 'top'
@@ -2756,8 +2744,7 @@ describe('Test axes', function() {
2756
2744
expect ( size . r ) . toBe ( previousSize . l ) ;
2757
2745
expect ( size . b ) . toBe ( initialSize . b ) ;
2758
2746
expect ( size . t ) . toBe ( previousSize . b ) ;
2759
- } )
2760
- . then ( function ( ) {
2747
+
2761
2748
return Plotly . relayout ( gd , {
2762
2749
'xaxis.automargin' : false ,
2763
2750
'yaxis.automargin' : false
0 commit comments