@@ -39,7 +39,11 @@ describe('Test plot structure', function() {
39
39
40
40
beforeEach ( function ( done ) {
41
41
gd = createGraphDiv ( ) ;
42
- Plotly . plot ( gd , mock . data , mock . layout ) . then ( done ) ;
42
+
43
+ var mockData = Lib . extendDeep ( [ ] , mock . data ) ,
44
+ mockLayout = Lib . extendDeep ( { } , mock . layout ) ;
45
+
46
+ Plotly . plot ( gd , mockData , mockLayout ) . then ( done ) ;
43
47
} ) ;
44
48
45
49
it ( 'has one *subplot xy* node' , function ( ) {
@@ -91,6 +95,35 @@ describe('Test plot structure', function() {
91
95
done ( ) ;
92
96
} ) ;
93
97
} ) ;
98
+
99
+ it ( 'should restore layout axes when they get deleted' , function ( done ) {
100
+ expect ( countScatterTraces ( ) ) . toEqual ( mock . data . length ) ;
101
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
102
+
103
+ Plotly . relayout ( gd , { xaxis : null , yaxis : null } ) . then ( function ( ) {
104
+ expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
105
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
106
+
107
+ return Plotly . relayout ( gd , 'xaxis' , null ) ;
108
+ } ) . then ( function ( ) {
109
+ expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
110
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
111
+
112
+ return Plotly . relayout ( gd , 'xaxis' , { } ) ;
113
+ } ) . then ( function ( ) {
114
+ expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
115
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
116
+
117
+ return Plotly . relayout ( gd , 'yaxis' , null ) ;
118
+ } ) . then ( function ( ) {
119
+ expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
120
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
121
+
122
+ return Plotly . relayout ( gd , 'yaxis' , { } ) ;
123
+ } ) . then ( function ( ) {
124
+ expect ( countScatterTraces ( ) ) . toEqual ( 1 ) ;
125
+ expect ( countSubplots ( ) ) . toEqual ( 1 ) ;
126
+
94
127
done ( ) ;
95
128
} ) ;
96
129
} ) ;
0 commit comments