@@ -272,9 +272,9 @@ describe('@gl parcoords', function() {
272
272
expect ( gd . data [ 0 ] . dimensions [ 1 ] . range ) . toBeDefined ( ) ;
273
273
expect ( gd . data [ 0 ] . dimensions [ 1 ] . range ) . toEqual ( [ 0 , 700000 ] ) ;
274
274
expect ( gd . data [ 0 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
275
-
276
- done ( ) ;
277
- } ) ;
275
+ } )
276
+ . catch ( fail )
277
+ . then ( done ) ;
278
278
} ) ;
279
279
280
280
it ( 'Do something sensible if there is no panel i.e. dimension count is less than 2' , function ( done ) {
@@ -291,9 +291,9 @@ describe('@gl parcoords', function() {
291
291
expect ( gd . data [ 0 ] . dimensions [ 0 ] . range ) . not . toBeDefined ( ) ;
292
292
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toBeDefined ( ) ;
293
293
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toEqual ( [ 200 , 700 ] ) ;
294
-
295
- done ( ) ;
296
- } ) ;
294
+ } )
295
+ . catch ( fail )
296
+ . then ( done ) ;
297
297
} ) ;
298
298
299
299
it ( 'Does not error with zero dimensions' , function ( done ) {
@@ -302,11 +302,13 @@ describe('@gl parcoords', function() {
302
302
var gd = createGraphDiv ( ) ;
303
303
304
304
Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( function ( ) {
305
+
305
306
expect ( gd . data . length ) . toEqual ( 1 ) ;
306
307
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 0 ) ;
307
308
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 0 ) ;
308
- done ( ) ;
309
- } ) ;
309
+ } )
310
+ . catch ( fail )
311
+ . then ( done ) ;
310
312
} ) ;
311
313
312
314
it ( 'Works with duplicate dimension labels' , function ( done ) {
@@ -322,8 +324,9 @@ describe('@gl parcoords', function() {
322
324
expect ( gd . data . length ) . toEqual ( 1 ) ;
323
325
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
324
326
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
325
- done ( ) ;
326
- } ) ;
327
+ } )
328
+ . catch ( fail )
329
+ . then ( done ) ;
327
330
} ) ;
328
331
329
332
it ( 'Works with a single line; also, use a longer color array than the number of lines' , function ( done ) {
@@ -349,8 +352,9 @@ describe('@gl parcoords', function() {
349
352
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
350
353
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
351
354
expect ( gd . data [ 0 ] . dimensions [ 0 ] . values . length ) . toEqual ( 1 ) ;
352
- done ( ) ;
353
- } ) ;
355
+ } )
356
+ . catch ( fail )
357
+ . then ( done ) ;
354
358
} ) ;
355
359
356
360
it ( 'Does not raise an error with zero lines and no specified range' , function ( done ) {
@@ -373,8 +377,9 @@ describe('@gl parcoords', function() {
373
377
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
374
378
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 0 ) ;
375
379
expect ( gd . data [ 0 ] . dimensions [ 0 ] . values . length ) . toEqual ( 0 ) ;
376
- done ( ) ;
377
- } ) ;
380
+ } )
381
+ . catch ( fail )
382
+ . then ( done ) ;
378
383
} ) ;
379
384
380
385
it ( 'Works with non-finite `values` elements' , function ( done ) {
@@ -401,8 +406,9 @@ describe('@gl parcoords', function() {
401
406
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 2 ) ;
402
407
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 2 ) ;
403
408
expect ( gd . data [ 0 ] . dimensions [ 0 ] . values . length ) . toEqual ( values [ 0 ] . length ) ;
404
- done ( ) ;
405
- } ) ;
409
+ } )
410
+ . catch ( fail )
411
+ . then ( done ) ;
406
412
} ) ;
407
413
408
414
it ( '@noCI Works with 60 dimensions' , function ( done ) {
@@ -431,8 +437,9 @@ describe('@gl parcoords', function() {
431
437
expect ( gd . data . length ) . toEqual ( 1 ) ;
432
438
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
433
439
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
434
- done ( ) ;
435
- } ) ;
440
+ } )
441
+ . catch ( fail )
442
+ . then ( done ) ;
436
443
} ) ;
437
444
438
445
it ( '@noCI Truncates 60+ dimensions to 60' , function ( done ) {
@@ -459,8 +466,9 @@ describe('@gl parcoords', function() {
459
466
expect ( gd . data . length ) . toEqual ( 1 ) ;
460
467
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
461
468
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
462
- done ( ) ;
463
- } ) ;
469
+ } )
470
+ . catch ( fail )
471
+ . then ( done ) ;
464
472
} ) ;
465
473
466
474
it ( '@noCI Truncates dimension values to the shortest array, retaining only 3 lines' , function ( done ) {
@@ -488,8 +496,9 @@ describe('@gl parcoords', function() {
488
496
expect ( gd . data . length ) . toEqual ( 1 ) ;
489
497
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 60 ) ;
490
498
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 60 ) ;
491
- done ( ) ;
492
- } ) ;
499
+ } )
500
+ . catch ( fail )
501
+ . then ( done ) ;
493
502
} ) ;
494
503
495
504
it ( 'Skip dimensions which are not plain objects or whose `values` is not an array' , function ( done ) {
@@ -521,8 +530,9 @@ describe('@gl parcoords', function() {
521
530
expect ( gd . data . length ) . toEqual ( 1 ) ;
522
531
expect ( gd . data [ 0 ] . dimensions . length ) . toEqual ( 5 ) ; // it's still five, but ...
523
532
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 3 ) ; // only 3 axes shown
524
- done ( ) ;
525
- } ) ;
533
+ } )
534
+ . catch ( fail )
535
+ . then ( done ) ;
526
536
} ) ;
527
537
528
538
@@ -539,7 +549,9 @@ describe('@gl parcoords', function() {
539
549
y : [ 0.05 , 0.85 ]
540
550
} ;
541
551
gd = createGraphDiv ( ) ;
542
- Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
552
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout )
553
+ . catch ( fail )
554
+ . then ( done ) ;
543
555
} ) ;
544
556
545
557
it ( '`Plotly.plot` should have proper fields on `gd.data` on initial rendering' , function ( ) {
@@ -584,9 +596,9 @@ describe('@gl parcoords', function() {
584
596
expect ( gd . data [ 1 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
585
597
586
598
expect ( document . querySelectorAll ( '.axis' ) . length ) . toEqual ( 20 ) ; // one dimension is `visible: false`
587
-
588
- done ( ) ;
589
- } ) ;
599
+ } )
600
+ . catch ( fail )
601
+ . then ( done ) ;
590
602
591
603
} ) ;
592
604
@@ -604,9 +616,9 @@ describe('@gl parcoords', function() {
604
616
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toBeDefined ( ) ;
605
617
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toEqual ( [ 100000 , 150000 ] ) ;
606
618
expect ( gd . data [ 0 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
607
-
608
- done ( ) ;
609
- } ) ;
619
+ } )
620
+ . catch ( fail )
621
+ . then ( done ) ;
610
622
611
623
} ) ;
612
624
@@ -632,6 +644,7 @@ describe('@gl parcoords', function() {
632
644
. then ( restyleDimension ( 'constraintrange' , [ [ 0 , 1 ] ] ) )
633
645
. then ( restyleDimension ( 'values' , [ [ 0 , 0.1 , 0.4 , 1 , 2 , 0 , 0.1 , 0.4 , 1 , 2 ] ] ) )
634
646
. then ( restyleDimension ( 'visible' , false ) )
647
+ . catch ( fail )
635
648
. then ( done ) ;
636
649
} ) ;
637
650
@@ -652,11 +665,9 @@ describe('@gl parcoords', function() {
652
665
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toBeDefined ( ) ;
653
666
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toEqual ( [ 100000 , 150000 ] ) ;
654
667
expect ( gd . data [ 0 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
655
-
656
- done ( ) ;
657
- } ) ;
658
-
659
-
668
+ } )
669
+ . catch ( fail )
670
+ . then ( done ) ;
660
671
} ) ;
661
672
662
673
it ( 'Should emit a \'plotly_restyle\' event' , function ( done ) {
@@ -677,10 +688,11 @@ describe('@gl parcoords', function() {
677
688
678
689
expect ( tester . get ( ) ) . toBe ( false ) ;
679
690
Plotly . restyle ( gd , 'line.colorscale' , 'Viridis' )
680
- . then ( window . setTimeout ( function ( ) {
681
- expect ( tester . get ( ) ) . toBe ( true ) ;
682
- done ( ) ;
683
- } , 0 ) ) ;
691
+ . then ( function ( ) {
692
+ expect ( tester . get ( ) ) . toBe ( true ) ;
693
+ } )
694
+ . catch ( fail )
695
+ . then ( done ) ;
684
696
685
697
} ) ;
686
698
@@ -715,20 +727,24 @@ describe('@gl parcoords', function() {
715
727
mouseEvent ( 'mousemove' , 315 , 218 ) ;
716
728
mouseEvent ( 'mouseover' , 315 , 218 ) ;
717
729
718
- window . setTimeout ( function ( ) {
730
+ new Promise ( function ( resolve ) {
731
+ window . setTimeout ( function ( ) {
719
732
720
- expect ( hoverTester . get ( ) ) . toBe ( true ) ;
733
+ expect ( hoverTester . get ( ) ) . toBe ( true ) ;
721
734
722
- mouseEvent ( 'mousemove' , 329 , 153 ) ;
723
- mouseEvent ( 'mouseover' , 329 , 153 ) ;
735
+ mouseEvent ( 'mousemove' , 329 , 153 ) ;
736
+ mouseEvent ( 'mouseover' , 329 , 153 ) ;
724
737
725
- window . setTimeout ( function ( ) {
738
+ window . setTimeout ( function ( ) {
726
739
727
- expect ( unhoverTester . get ( ) ) . toBe ( true ) ;
728
- done ( ) ;
729
- } , 20 ) ;
740
+ expect ( unhoverTester . get ( ) ) . toBe ( true ) ;
741
+ resolve ( ) ;
742
+ } , 20 ) ;
730
743
731
- } , 20 ) ;
744
+ } , 20 ) ;
745
+ } )
746
+ . catch ( fail )
747
+ . then ( done ) ;
732
748
733
749
} ) ;
734
750
@@ -747,10 +763,9 @@ describe('@gl parcoords', function() {
747
763
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toBeDefined ( ) ;
748
764
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toEqual ( [ 100000 , 150000 ] ) ;
749
765
expect ( gd . data [ 0 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
750
-
751
- done ( ) ;
752
- } ) ;
753
-
766
+ } )
767
+ . catch ( fail )
768
+ . then ( done ) ;
754
769
} ) ;
755
770
756
771
it ( 'Calling `Plotly.relayout`with object should amend the preexisting parcoords' , function ( done ) {
@@ -768,10 +783,9 @@ describe('@gl parcoords', function() {
768
783
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toBeDefined ( ) ;
769
784
expect ( gd . data [ 0 ] . dimensions [ 0 ] . constraintrange ) . toEqual ( [ 100000 , 150000 ] ) ;
770
785
expect ( gd . data [ 0 ] . dimensions [ 1 ] . constraintrange ) . not . toBeDefined ( ) ;
771
-
772
- done ( ) ;
773
- } ) ;
774
-
786
+ } )
787
+ . catch ( fail )
788
+ . then ( done ) ;
775
789
} ) ;
776
790
777
791
it ( '@flaky Calling `Plotly.animate` with patches targeting `dimensions` attributes should do the right thing' , function ( done ) {
@@ -827,12 +841,13 @@ describe('@gl parcoords', function() {
827
841
828
842
expect ( gd . data . length ) . toEqual ( 1 ) ;
829
843
830
- Plotly . deleteTraces ( gd , 0 ) . then ( function ( ) {
844
+ return Plotly . deleteTraces ( gd , 0 ) . then ( function ( ) {
831
845
expect ( d3 . selectAll ( '.gl-canvas' ) . node ( 0 ) ) . toEqual ( null ) ;
832
846
expect ( gd . data . length ) . toEqual ( 0 ) ;
833
- done ( ) ;
834
847
} ) ;
835
- } ) ;
848
+ } )
849
+ . catch ( fail )
850
+ . then ( done ) ;
836
851
} ) ;
837
852
838
853
it ( 'Plotly.deleteTraces with two traces removes the deleted plot' , function ( done ) {
@@ -864,8 +879,9 @@ describe('@gl parcoords', function() {
864
879
expect ( document . querySelectorAll ( '.gl-canvas' ) . length ) . toEqual ( 0 ) ;
865
880
expect ( document . querySelectorAll ( '.y-axis' ) . length ) . toEqual ( 0 ) ;
866
881
expect ( gd . data . length ) . toEqual ( 0 ) ;
867
- done ( ) ;
868
- } ) ;
882
+ } )
883
+ . catch ( fail )
884
+ . then ( done ) ;
869
885
} ) ;
870
886
871
887
it ( 'Calling `Plotly.restyle` with zero panels left should erase lines' , function ( done ) {
@@ -894,8 +910,9 @@ describe('@gl parcoords', function() {
894
910
} while ( ! foundPixel && i < imageArray . length ) ;
895
911
expect ( foundPixel ) . toEqual ( false ) ;
896
912
} ) ;
897
- done ( ) ;
898
- } ) ;
913
+ } )
914
+ . catch ( fail )
915
+ . then ( done ) ;
899
916
} ) ;
900
917
901
918
describe ( 'Having two datasets' , function ( ) {
@@ -925,9 +942,9 @@ describe('@gl parcoords', function() {
925
942
expect ( 1 ) . toEqual ( 1 ) ;
926
943
expect ( document . querySelectorAll ( '.gl-container' ) . length ) . toEqual ( 1 ) ;
927
944
expect ( gd . data . length ) . toEqual ( 2 ) ;
928
-
929
- done ( ) ;
930
- } ) ;
945
+ } )
946
+ . catch ( fail )
947
+ . then ( done ) ;
931
948
} ) ;
932
949
933
950
it ( 'Plotly.addTraces should add a new parcoords row' , function ( done ) {
@@ -952,10 +969,9 @@ describe('@gl parcoords', function() {
952
969
. then ( function ( ) {
953
970
expect ( document . querySelectorAll ( '.gl-container' ) . length ) . toEqual ( 1 ) ;
954
971
expect ( gd . data . length ) . toEqual ( 2 ) ;
955
-
956
- done ( ) ;
957
- } ) ;
958
-
972
+ } )
973
+ . catch ( fail )
974
+ . then ( done ) ;
959
975
} ) ;
960
976
961
977
it ( 'Plotly.restyle should update the existing parcoords row' , function ( done ) {
@@ -1001,10 +1017,9 @@ describe('@gl parcoords', function() {
1001
1017
1002
1018
expect ( document . querySelectorAll ( '.gl-container' ) . length ) . toEqual ( 1 ) ;
1003
1019
expect ( gd . data . length ) . toEqual ( 1 ) ;
1004
-
1005
- done ( ) ;
1006
- } ) ;
1007
-
1020
+ } )
1021
+ . catch ( fail )
1022
+ . then ( done ) ;
1008
1023
} ) ;
1009
1024
} ) ;
1010
1025
} ) ;
0 commit comments