@@ -26,7 +26,9 @@ describe('Test gl3d axes defaults', function() {
26
26
} ;
27
27
28
28
beforeEach ( function ( ) {
29
- layoutOut = { } ;
29
+ layoutOut = {
30
+ axesconvertnumeric : true
31
+ } ;
30
32
} ) ;
31
33
32
34
it ( 'should define specific default set with empty initial layout' , function ( ) {
@@ -128,6 +130,7 @@ describe('Test Gl3d layout defaults', function() {
128
130
129
131
beforeEach ( function ( ) {
130
132
layoutOut = {
133
+ axesconvertnumeric : true ,
131
134
_basePlotModules : [ 'gl3d' ] ,
132
135
_dfltTitle : { x : 'xxx' , y : 'yyy' , colorbar : 'cbbb' } ,
133
136
_subplots : { gl3d : [ 'scene' ] }
@@ -380,6 +383,66 @@ describe('Test Gl3d layout defaults', function() {
380
383
expect ( layoutOut . scene . zaxis . gridcolor )
381
384
. toEqual ( tinycolor . mix ( '#444' , bgColor , frac ) . toRgbString ( ) ) ;
382
385
} ) ;
386
+
387
+ it ( 'should disable converting numeric strings using axis.convertnumeric' , function ( ) {
388
+ supplyLayoutDefaults ( {
389
+ scene : {
390
+ xaxis : {
391
+ convertnumeric : false
392
+ } ,
393
+ yaxis : {
394
+ convertnumeric : false
395
+ } ,
396
+ zaxis : {
397
+ convertnumeric : false
398
+ }
399
+ }
400
+ } , layoutOut , [ {
401
+ type : 'scatter3d' ,
402
+ x : [ '0' , '1' , '1970' , '2000' ] ,
403
+ y : [ '0' , '1' , '1970' , '2000' ] ,
404
+ z : [ '0' , '1' , '1970' , '2000' ] ,
405
+ scene : 'scene'
406
+ } ] ) ;
407
+
408
+ expect ( layoutOut . scene . xaxis . convertnumeric ) . toBe ( false ) ;
409
+ expect ( layoutOut . scene . yaxis . convertnumeric ) . toBe ( false ) ;
410
+ expect ( layoutOut . scene . zaxis . convertnumeric ) . toBe ( false ) ;
411
+ expect ( layoutOut . scene . xaxis . type ) . toBe ( 'category' ) ;
412
+ expect ( layoutOut . scene . yaxis . type ) . toBe ( 'category' ) ;
413
+ expect ( layoutOut . scene . zaxis . type ) . toBe ( 'category' ) ;
414
+ } ) ;
415
+
416
+ it ( 'should enable converting numeric strings using axis.convertnumeric and inherit defaults from layout.axesconvertnumeric' , function ( ) {
417
+ layoutOut . axesconvertnumeric = false ;
418
+
419
+ supplyLayoutDefaults ( {
420
+ scene : {
421
+ xaxis : {
422
+ convertnumeric : true
423
+ } ,
424
+ yaxis : {
425
+ convertnumeric : true
426
+ } ,
427
+ zaxis : {
428
+ convertnumeric : true
429
+ }
430
+ }
431
+ } , layoutOut , [ {
432
+ type : 'scatter3d' ,
433
+ x : [ '0' , '1' , '1970' , '2000' ] ,
434
+ y : [ '0' , '1' , '1970' , '2000' ] ,
435
+ z : [ '0' , '1' , '1970' , '2000' ] ,
436
+ scene : 'scene'
437
+ } ] ) ;
438
+
439
+ expect ( layoutOut . scene . xaxis . convertnumeric ) . toBe ( true ) ;
440
+ expect ( layoutOut . scene . yaxis . convertnumeric ) . toBe ( true ) ;
441
+ expect ( layoutOut . scene . zaxis . convertnumeric ) . toBe ( true ) ;
442
+ expect ( layoutOut . scene . xaxis . type ) . toBe ( 'linear' ) ;
443
+ expect ( layoutOut . scene . yaxis . type ) . toBe ( 'linear' ) ;
444
+ expect ( layoutOut . scene . zaxis . type ) . toBe ( 'linear' ) ;
445
+ } ) ;
383
446
} ) ;
384
447
} ) ;
385
448
0 commit comments