@@ -118,6 +118,109 @@ describe('carpet supplyDefaults', function() {
118
118
});*/
119
119
} ) ;
120
120
121
+ describe ( 'supplyDefaults visibility check' , function ( ) {
122
+ it ( 'does not hide empty subplots' , function ( ) {
123
+ var gd = { data : [ ] , layout : { xaxis : { } } } ;
124
+ Plots . supplyDefaults ( gd ) ;
125
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( true ) ;
126
+ } ) ;
127
+
128
+ it ( 'does not hide axes with non-carpet traces' , function ( ) {
129
+ var gd = { data : [ { x : [ ] } ] } ;
130
+ Plots . supplyDefaults ( gd ) ;
131
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( true ) ;
132
+ } ) ;
133
+
134
+ it ( 'does not hide axes with non-cheater carpet' , function ( ) {
135
+ var gd = { data : [ {
136
+ type : 'carpet' ,
137
+ a : [ 1 , 2 , 3 ] ,
138
+ b : [ 1 , 2 ] ,
139
+ x : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
140
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
141
+ } , {
142
+ type : 'contourcarpet' ,
143
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
144
+ } ] } ;
145
+ Plots . supplyDefaults ( gd ) ;
146
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( true ) ;
147
+ } ) ;
148
+
149
+ it ( 'hides axes with cheater' , function ( ) {
150
+ var gd = { data : [ {
151
+ type : 'carpet' ,
152
+ a : [ 1 , 2 , 3 ] ,
153
+ b : [ 1 , 2 ] ,
154
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
155
+ } , {
156
+ type : 'contourcarpet' ,
157
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
158
+ } ] } ;
159
+ Plots . supplyDefaults ( gd ) ;
160
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( false ) ;
161
+ } ) ;
162
+
163
+ it ( 'does not hide an axis with cheater and non-cheater carpet' , function ( ) {
164
+ var gd = {
165
+ data : [ {
166
+ carpetid : 'c1' ,
167
+ type : 'carpet' ,
168
+ a : [ 1 , 2 , 3 ] ,
169
+ b : [ 1 , 2 ] ,
170
+ x : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
171
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
172
+ } , {
173
+ carpetid : 'c2' ,
174
+ type : 'carpet' ,
175
+ a : [ 1 , 2 , 3 ] ,
176
+ b : [ 1 , 2 ] ,
177
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
178
+ } , {
179
+ carpetid : 'c1' ,
180
+ type : 'contourcarpet' ,
181
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
182
+ } , {
183
+ carpetid : 'c2' ,
184
+ type : 'contourcarpet' ,
185
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
186
+ } ]
187
+ } ;
188
+
189
+ Plots . supplyDefaults ( gd ) ;
190
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( true ) ;
191
+ } ) ;
192
+
193
+ it ( 'does not hide an axis with cheater and non-cheater carpet' , function ( ) {
194
+ var gd = {
195
+ data : [ {
196
+ carpetid : 'c1' ,
197
+ type : 'carpet' ,
198
+ a : [ 1 , 2 , 3 ] ,
199
+ b : [ 1 , 2 ] ,
200
+ x : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
201
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
202
+ } , {
203
+ carpetid : 'c2' ,
204
+ type : 'carpet' ,
205
+ a : [ 1 , 2 , 3 ] ,
206
+ b : [ 1 , 2 ] ,
207
+ y : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
208
+ } , {
209
+ carpetid : 'c1' ,
210
+ type : 'contourcarpet' ,
211
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
212
+ } , {
213
+ carpetid : 'c2' ,
214
+ type : 'contourcarpet' ,
215
+ z : [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] ] ,
216
+ } ]
217
+ } ;
218
+
219
+ Plots . supplyDefaults ( gd ) ;
220
+ expect ( gd . _fullLayout . xaxis . visible ) . toBe ( true ) ;
221
+ } ) ;
222
+ } ) ;
223
+
121
224
describe ( 'carpet smooth_fill_2d_array' , function ( ) {
122
225
if ( ! test . smoothFill2D ) return ;
123
226
var _ ;
0 commit comments