@@ -360,7 +360,7 @@ describe('parcoords edge cases', function() {
360
360
361
361
it ( '@gl Works fine with one panel only' , function ( done ) {
362
362
var mockCopy = Lib . extendDeep ( { } , mock2 ) ;
363
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
363
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
364
364
expect ( gd . data . length ) . toEqual ( 1 ) ;
365
365
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
366
366
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
@@ -378,7 +378,7 @@ describe('parcoords edge cases', function() {
378
378
379
379
it ( '@gl Do something sensible if there is no panel i.e. dimension count is less than 2' , function ( done ) {
380
380
var mockCopy = Lib . extendDeep ( { } , mock1 ) ;
381
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
381
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
382
382
expect ( gd . data . length ) . toEqual ( 1 ) ;
383
383
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 1 ) ;
384
384
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 1 ) ; // sole axis still shows up
@@ -395,7 +395,7 @@ describe('parcoords edge cases', function() {
395
395
it ( '@gl Does not error with zero dimensions' , function ( done ) {
396
396
var mockCopy = Lib . extendDeep ( { } , mock0 ) ;
397
397
398
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
398
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
399
399
expect ( gd . data . length ) . toEqual ( 1 ) ;
400
400
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 0 ) ;
401
401
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 0 ) ;
@@ -404,13 +404,32 @@ describe('parcoords edge cases', function() {
404
404
. then ( done ) ;
405
405
} ) ;
406
406
407
+ it ( '@gl Does not error with dimensions including only 0' , function ( done ) {
408
+ Plotly . plot ( gd , {
409
+ data : [ {
410
+ type : 'parcoords' ,
411
+ dimensions : [ {
412
+ label : 'all zero' ,
413
+ values : [ 0 , 0 ]
414
+ } ]
415
+ } ] ,
416
+ layout : { }
417
+ } ) . then ( function ( ) {
418
+ expect ( gd . data . length ) . toEqual ( 1 ) ;
419
+ expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 1 ) ;
420
+ expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 1 ) ;
421
+ } )
422
+ . catch ( failTest )
423
+ . then ( done ) ;
424
+ } ) ;
425
+
407
426
it ( '@gl Works with duplicate dimension labels' , function ( done ) {
408
427
var mockCopy = Lib . extendDeep ( { } , mock2 ) ;
409
428
410
429
mockCopy . layout . width = 320 ;
411
430
mockCopy . data [ 0 ] . dimensions [ 1 ] . label = mockCopy . data [ 0 ] . dimensions [ 0 ] . label ;
412
431
413
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
432
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
414
433
expect ( gd . data . length ) . toEqual ( 1 ) ;
415
434
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
416
435
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
@@ -434,7 +453,7 @@ describe('parcoords edge cases', function() {
434
453
}
435
454
}
436
455
437
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
456
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
438
457
expect ( gd . data . length ) . toEqual ( 1 ) ;
439
458
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
440
459
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
@@ -456,7 +475,7 @@ describe('parcoords edge cases', function() {
456
475
dim . values = [ ] ;
457
476
}
458
477
459
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
478
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
460
479
expect ( gd . data . length ) . toEqual ( 1 ) ;
461
480
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
462
481
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 0 ) ;
@@ -482,7 +501,7 @@ describe('parcoords edge cases', function() {
482
501
}
483
502
}
484
503
485
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
504
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
486
505
expect ( gd . data . length ) . toEqual ( 1 ) ;
487
506
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
488
507
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
@@ -511,7 +530,7 @@ describe('parcoords edge cases', function() {
511
530
mockCopy . data [ 0 ] . dimensions [ i ] = newDimension ;
512
531
}
513
532
514
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
533
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
515
534
expect ( gd . data . length ) . toEqual ( 1 ) ;
516
535
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
517
536
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
@@ -537,7 +556,7 @@ describe('parcoords edge cases', function() {
537
556
mockCopy . data [ 0 ] . dimensions [ i ] = newDimension ;
538
557
}
539
558
540
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
559
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
541
560
expect ( gd . data . length ) . toEqual ( 1 ) ;
542
561
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
543
562
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
@@ -564,7 +583,7 @@ describe('parcoords edge cases', function() {
564
583
mockCopy . data [ 0 ] . dimensions [ i ] = newDimension ;
565
584
}
566
585
567
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
586
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
568
587
expect ( gd . data . length ) . toEqual ( 1 ) ;
569
588
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
570
589
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
@@ -595,7 +614,7 @@ describe('parcoords edge cases', function() {
595
614
mockCopy . data [ 0 ] . dimensions [ 0 ] = 'This is not a plain object' ;
596
615
mockCopy . data [ 0 ] . dimensions [ 1 ] . values = 'This is not an array' ;
597
616
598
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
617
+ Plotly . plot ( gd , mockCopy ) . then ( function ( ) {
599
618
expect ( gd . data . length ) . toEqual ( 1 ) ;
600
619
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 5 ) ; // it's still five, but ...
601
620
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 3 ) ; // only 3 axes shown
@@ -921,7 +940,7 @@ describe('parcoords basic use', function() {
921
940
reversedMockCopy . data [ 0 ] . dimensions . forEach ( function ( d ) { d . id = 'R_' + d . id ; } ) ;
922
941
reversedMockCopy . data [ 0 ] . dimensions . forEach ( function ( d ) { d . label = 'R_' + d . label ; } ) ;
923
942
924
- Plotly . plot ( gd , reversedMockCopy . data , reversedMockCopy . layout ) . then ( function ( ) {
943
+ Plotly . plot ( gd , reversedMockCopy ) . then ( function ( ) {
925
944
expect ( gd . data . length ) . toEqual ( 2 ) ;
926
945
927
946
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 11 ) ;
0 commit comments