@@ -217,6 +217,55 @@ describe('supplyDefaults visibility check', function() {
217
217
} ) ;
218
218
} ) ;
219
219
220
+ describe ( 'Test carpet autoType' , function ( ) {
221
+ it ( 'should disable converting numeric strings using axis.convertnumeric' , function ( ) {
222
+ var gd = {
223
+ layout : {
224
+ xaxis : { convertnumeric : false } ,
225
+ yaxis : { }
226
+ } ,
227
+ data : [ {
228
+ type : 'carpet' ,
229
+ a : [ '1' , '2' , '3' ] ,
230
+ b : [ '1' , '2' ] ,
231
+ x : [ [ '1' , '2' , '3' ] , [ '4' , '5' , '6' ] ] ,
232
+ y : [ [ '1' , '2' , '3' ] , [ '4' , '5' , '6' ] ] ,
233
+ } ]
234
+ } ;
235
+
236
+ supplyAllDefaults ( gd ) ;
237
+
238
+ expect ( gd . _fullLayout . xaxis . convertnumeric ) . toBe ( false ) ;
239
+ expect ( gd . _fullLayout . yaxis . convertnumeric ) . toBe ( true ) ;
240
+ expect ( gd . _fullLayout . xaxis . type ) . toBe ( 'category' ) ;
241
+ expect ( gd . _fullLayout . yaxis . type ) . toBe ( 'linear' ) ;
242
+ } ) ;
243
+
244
+ it ( 'should enable converting numeric strings using axis.convertnumeric and inherit defaults from layout.axesconvertnumeric' , function ( ) {
245
+ var gd = {
246
+ layout : {
247
+ axesconvertnumeric : false ,
248
+ xaxis : { convertnumeric : true } ,
249
+ yaxis : { }
250
+ } ,
251
+ data : [ {
252
+ type : 'carpet' ,
253
+ a : [ '1' , '2' , '3' ] ,
254
+ b : [ '1' , '2' ] ,
255
+ x : [ [ '1' , '2' , '3' ] , [ '4' , '5' , '6' ] ] ,
256
+ y : [ [ '1' , '2' , '3' ] , [ '4' , '5' , '6' ] ] ,
257
+ } ]
258
+ } ;
259
+
260
+ supplyAllDefaults ( gd ) ;
261
+
262
+ expect ( gd . _fullLayout . xaxis . convertnumeric ) . toBe ( true ) ;
263
+ expect ( gd . _fullLayout . yaxis . convertnumeric ) . toBe ( false ) ;
264
+ expect ( gd . _fullLayout . xaxis . type ) . toBe ( 'linear' ) ;
265
+ expect ( gd . _fullLayout . yaxis . type ) . toBe ( 'category' ) ;
266
+ } ) ;
267
+ } ) ;
268
+
220
269
describe ( 'carpet smooth_fill_2d_array' , function ( ) {
221
270
var _ ;
222
271
0 commit comments