@@ -39,7 +39,11 @@ describe('Test plot structure', function() {
3939
4040 beforeEach ( function ( done ) {
4141 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 ) ;
4347 } ) ;
4448
4549 it ( 'has one *subplot xy* node' , function ( ) {
@@ -91,6 +95,35 @@ describe('Test plot structure', function() {
9195 done ( ) ;
9296 } ) ;
9397 } ) ;
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+
94127 done ( ) ;
95128 } ) ;
96129 } ) ;
0 commit comments