@@ -399,12 +399,15 @@ describe('Test Gl3d layout defaults', function() {
399
399
scene : 'scene'
400
400
} ] ) ;
401
401
402
- expect ( layoutOut . scene . xaxis . autotypenumbers ) . toBe ( 'strict' ) ;
403
- expect ( layoutOut . scene . yaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
404
- expect ( layoutOut . scene . zaxis . autotypenumbers ) . toBe ( 'strict' ) ;
405
- expect ( layoutOut . scene . xaxis . type ) . toBe ( 'category' ) ;
406
- expect ( layoutOut . scene . yaxis . type ) . toBe ( 'linear' ) ;
407
- expect ( layoutOut . scene . zaxis . type ) . toBe ( 'category' ) ;
402
+ var xaxis = layoutOut . scene . xaxis ;
403
+ var yaxis = layoutOut . scene . yaxis ;
404
+ var zaxis = layoutOut . scene . zaxis ;
405
+ expect ( xaxis . autotypenumbers ) . toBe ( 'strict' ) ;
406
+ expect ( yaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
407
+ expect ( zaxis . autotypenumbers ) . toBe ( 'strict' ) ;
408
+ expect ( xaxis . type ) . toBe ( 'category' ) ;
409
+ expect ( yaxis . type ) . toBe ( 'linear' ) ;
410
+ expect ( zaxis . type ) . toBe ( 'category' ) ;
408
411
} ) ;
409
412
410
413
it ( 'should enable converting numeric strings using axis.autotypenumbers and inherit defaults from layout.autotypenumbers' , function ( ) {
@@ -424,12 +427,112 @@ describe('Test Gl3d layout defaults', function() {
424
427
scene : 'scene'
425
428
} ] ) ;
426
429
427
- expect ( layoutOut . scene . xaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
428
- expect ( layoutOut . scene . yaxis . autotypenumbers ) . toBe ( 'strict' ) ;
429
- expect ( layoutOut . scene . zaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
430
- expect ( layoutOut . scene . xaxis . type ) . toBe ( 'linear' ) ;
431
- expect ( layoutOut . scene . yaxis . type ) . toBe ( 'category' ) ;
432
- expect ( layoutOut . scene . zaxis . type ) . toBe ( 'linear' ) ;
430
+ var xaxis = layoutOut . scene . xaxis ;
431
+ var yaxis = layoutOut . scene . yaxis ;
432
+ var zaxis = layoutOut . scene . zaxis ;
433
+ expect ( xaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
434
+ expect ( yaxis . autotypenumbers ) . toBe ( 'strict' ) ;
435
+ expect ( zaxis . autotypenumbers ) . toBe ( 'convert types' ) ;
436
+ expect ( xaxis . type ) . toBe ( 'linear' ) ;
437
+ expect ( yaxis . type ) . toBe ( 'category' ) ;
438
+ expect ( zaxis . type ) . toBe ( 'linear' ) ;
439
+ } ) ;
440
+
441
+ [ 'convert types' , 'strict' ] . forEach ( function ( autotypenumbers ) {
442
+ it ( 'with autotypenumbers: *' + autotypenumbers + '* should autotype *linear* case of 2d array' , function ( ) {
443
+ var typedArray = new Float32Array ( 2 ) ;
444
+ typedArray [ 0 ] = 0 ;
445
+ typedArray [ 1 ] = 1 ;
446
+
447
+ supplyLayoutDefaults ( {
448
+ scene : {
449
+ xaxis : { autotypenumbers : autotypenumbers } ,
450
+ yaxis : { autotypenumbers : autotypenumbers } ,
451
+ zaxis : { autotypenumbers : autotypenumbers }
452
+ }
453
+ } , layoutOut , [ {
454
+ scene : 'scene' ,
455
+ type : 'surface' ,
456
+ x : [ 0 , 1 ] ,
457
+ y : typedArray ,
458
+ z : [
459
+ typedArray ,
460
+ [ 1 , 0 ]
461
+ ]
462
+ } ] ) ;
463
+
464
+ var xaxis = layoutOut . scene . xaxis ;
465
+ var yaxis = layoutOut . scene . yaxis ;
466
+ var zaxis = layoutOut . scene . zaxis ;
467
+ expect ( xaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
468
+ expect ( yaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
469
+ expect ( zaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
470
+ expect ( xaxis . type ) . toBe ( 'linear' ) ;
471
+ expect ( yaxis . type ) . toBe ( 'linear' ) ;
472
+ expect ( zaxis . type ) . toBe ( 'linear' ) ;
473
+ } ) ;
474
+ } ) ;
475
+
476
+ [ 'convert types' , 'strict' ] . forEach ( function ( autotypenumbers ) {
477
+ it ( 'with autotypenumbers: *' + autotypenumbers + '* should autotype *category* case of 2d array' , function ( ) {
478
+ supplyLayoutDefaults ( {
479
+ scene : {
480
+ xaxis : { autotypenumbers : autotypenumbers } ,
481
+ yaxis : { autotypenumbers : autotypenumbers } ,
482
+ zaxis : { autotypenumbers : autotypenumbers }
483
+ }
484
+ } , layoutOut , [ {
485
+ scene : 'scene' ,
486
+ type : 'surface' ,
487
+ x : [ 'A' , 'B' ] ,
488
+ y : [ 'C' , 'D' ] ,
489
+ z : [
490
+ [ 'E' , 'F' ] ,
491
+ [ 'F' , 'E' ]
492
+ ]
493
+ } ] ) ;
494
+
495
+ var xaxis = layoutOut . scene . xaxis ;
496
+ var yaxis = layoutOut . scene . yaxis ;
497
+ var zaxis = layoutOut . scene . zaxis ;
498
+ expect ( xaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
499
+ expect ( yaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
500
+ expect ( zaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
501
+ expect ( xaxis . type ) . toBe ( 'category' ) ;
502
+ expect ( yaxis . type ) . toBe ( 'category' ) ;
503
+ expect ( zaxis . type ) . toBe ( 'category' ) ;
504
+ } ) ;
505
+ } ) ;
506
+
507
+ [ 'convert types' , 'strict' ] . forEach ( function ( autotypenumbers ) {
508
+ it ( 'with autotypenumbers: *' + autotypenumbers + '* should autotype *date* case of 2d array' , function ( ) {
509
+ supplyLayoutDefaults ( {
510
+ scene : {
511
+ xaxis : { autotypenumbers : autotypenumbers } ,
512
+ yaxis : { autotypenumbers : autotypenumbers } ,
513
+ zaxis : { autotypenumbers : autotypenumbers }
514
+ }
515
+ } , layoutOut , [ {
516
+ scene : 'scene' ,
517
+ type : 'surface' ,
518
+ x : [ '00-01' , '00-02' ] ,
519
+ y : [ '00-01' , '00-02' ] ,
520
+ z : [
521
+ [ '00-01' , '00-02' ] ,
522
+ [ '00-02' , '00-01' ]
523
+ ]
524
+ } ] ) ;
525
+
526
+ var xaxis = layoutOut . scene . xaxis ;
527
+ var yaxis = layoutOut . scene . yaxis ;
528
+ var zaxis = layoutOut . scene . zaxis ;
529
+ expect ( xaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
530
+ expect ( yaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
531
+ expect ( zaxis . autotypenumbers ) . toBe ( autotypenumbers ) ;
532
+ expect ( xaxis . type ) . toBe ( 'date' ) ;
533
+ expect ( yaxis . type ) . toBe ( 'date' ) ;
534
+ expect ( zaxis . type ) . toBe ( 'date' ) ;
535
+ } ) ;
433
536
} ) ;
434
537
} ) ;
435
538
} ) ;
0 commit comments