@@ -571,14 +571,18 @@ describe('Test gl3d modebar handlers - perspective case', function() {
571
571
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . eye ) . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
572
572
573
573
gd . once ( 'plotly_relayout' , function ( ) {
574
- assertScenes ( gd . _fullLayout , 'camera.eye.x' , 1.25 ) ;
575
- assertScenes ( gd . _fullLayout , 'camera.eye.y' , 1.25 ) ;
576
- assertScenes ( gd . _fullLayout , 'camera.eye.z' , 1.25 ) ;
574
+ return new Promise ( function ( resolve ) {
575
+ assertScenes ( gd . _fullLayout , 'camera.eye.x' , 1.25 ) ;
576
+ assertScenes ( gd . _fullLayout , 'camera.eye.y' , 1.25 ) ;
577
+ assertScenes ( gd . _fullLayout , 'camera.eye.z' , 1.25 ) ;
577
578
578
- expect ( gd . _fullLayout . scene . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
579
- expect ( gd . _fullLayout . scene2 . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
579
+ expect ( gd . _fullLayout . scene . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
580
+ expect ( gd . _fullLayout . scene2 . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
580
581
581
- done ( ) ;
582
+ resolve ( ) ;
583
+ } )
584
+ . catch ( failTest )
585
+ . then ( done ) ;
582
586
} ) ;
583
587
584
588
buttonDefault . click ( ) ;
@@ -594,17 +598,21 @@ describe('Test gl3d modebar handlers - perspective case', function() {
594
598
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
595
599
596
600
gd . once ( 'plotly_relayout' , function ( ) {
597
- expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
598
- expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
599
-
600
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
601
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
602
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
603
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
604
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
605
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
606
-
607
- done ( ) ;
601
+ return new Promise ( function ( resolve ) {
602
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
603
+ expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
604
+
605
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
606
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
607
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
608
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
609
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
610
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
611
+
612
+ resolve ( ) ;
613
+ } )
614
+ . catch ( failTest )
615
+ . then ( done ) ;
608
616
} ) ;
609
617
610
618
buttonDefault . click ( ) ;
@@ -620,14 +628,18 @@ describe('Test gl3d modebar handlers - perspective case', function() {
620
628
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
621
629
622
630
gd . once ( 'plotly_relayout' , function ( ) {
623
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
624
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
625
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
626
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
627
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
628
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
629
-
630
- done ( ) ;
631
+ return new Promise ( function ( resolve ) {
632
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
633
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
634
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
635
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
636
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
637
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
638
+
639
+ resolve ( ) ;
640
+ } )
641
+ . catch ( failTest )
642
+ . then ( done ) ;
631
643
} ) ;
632
644
633
645
buttonDefault . click ( ) ;
@@ -777,14 +789,18 @@ describe('Test gl3d modebar handlers - orthographic case', function() {
777
789
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . eye ) . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
778
790
779
791
gd . once ( 'plotly_relayout' , function ( ) {
780
- assertScenes ( gd . _fullLayout , 'camera.eye.x' , 1.25 ) ;
781
- assertScenes ( gd . _fullLayout , 'camera.eye.y' , 1.25 ) ;
782
- assertScenes ( gd . _fullLayout , 'camera.eye.z' , 1.25 ) ;
792
+ return new Promise ( function ( resolve ) {
793
+ assertScenes ( gd . _fullLayout , 'camera.eye.x' , 1.25 ) ;
794
+ assertScenes ( gd . _fullLayout , 'camera.eye.y' , 1.25 ) ;
795
+ assertScenes ( gd . _fullLayout , 'camera.eye.z' , 1.25 ) ;
783
796
784
- expect ( gd . _fullLayout . scene . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
785
- expect ( gd . _fullLayout . scene2 . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
797
+ expect ( gd . _fullLayout . scene . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
798
+ expect ( gd . _fullLayout . scene2 . _scene . getCamera ( ) . eye . z ) . toBeCloseTo ( 1.25 ) ;
786
799
787
- done ( ) ;
800
+ resolve ( ) ;
801
+ } )
802
+ . catch ( failTest )
803
+ . then ( done ) ;
788
804
} ) ;
789
805
790
806
buttonDefault . click ( ) ;
@@ -800,17 +816,21 @@ describe('Test gl3d modebar handlers - orthographic case', function() {
800
816
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
801
817
802
818
gd . once ( 'plotly_relayout' , function ( ) {
803
- expect ( gd . _fullLayout . scene . _scene . aspectmode ) . toEqual ( undefined ) ;
804
- expect ( gd . _fullLayout . scene2 . _scene . aspectmode ) . toEqual ( undefined ) ;
805
-
806
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
807
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
808
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
809
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
810
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
811
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
812
-
813
- done ( ) ;
819
+ return new Promise ( function ( resolve ) {
820
+ expect ( gd . _fullLayout . scene . _scene . aspectmode ) . toEqual ( undefined ) ;
821
+ expect ( gd . _fullLayout . scene2 . _scene . aspectmode ) . toEqual ( undefined ) ;
822
+
823
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
824
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
825
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
826
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
827
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
828
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
829
+
830
+ resolve ( ) ;
831
+ } )
832
+ . catch ( failTest )
833
+ . then ( done ) ;
814
834
} ) ;
815
835
816
836
buttonDefault . click ( ) ;
@@ -826,17 +846,21 @@ describe('Test gl3d modebar handlers - orthographic case', function() {
826
846
expect ( gd . _fullLayout . scene2 . _scene . viewInitial . aspectratio ) . toEqual ( { x : 3 , y : 2 , z : 1 } ) ;
827
847
828
848
gd . once ( 'plotly_relayout' , function ( ) {
829
- expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
830
- expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
831
-
832
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
833
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
834
- expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
835
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
836
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
837
- expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
838
-
839
- done ( ) ;
849
+ return new Promise ( function ( resolve ) {
850
+ expect ( gd . _fullLayout . scene . _scene . fullSceneLayout . aspectmode ) . toBe ( 'auto' ) ;
851
+ expect ( gd . _fullLayout . scene2 . _scene . fullSceneLayout . aspectmode ) . toBe ( 'manual' ) ;
852
+
853
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 1 ) ;
854
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 1 ) ;
855
+ expect ( gd . _fullLayout . scene . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
856
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . x ) . toBeCloseTo ( 3 ) ;
857
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . y ) . toBeCloseTo ( 2 ) ;
858
+ expect ( gd . _fullLayout . scene2 . _scene . glplot . getAspectratio ( ) . z ) . toBeCloseTo ( 1 ) ;
859
+
860
+ resolve ( ) ;
861
+ } )
862
+ . catch ( failTest )
863
+ . then ( done ) ;
840
864
} ) ;
841
865
842
866
buttonDefault . click ( ) ;
@@ -1631,23 +1655,16 @@ describe('Test gl3d relayout calls', function() {
1631
1655
} )
1632
1656
. then ( function ( ) {
1633
1657
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1634
- } )
1635
- . then ( function ( ) {
1658
+
1636
1659
return Plotly . relayout ( gd , 'scene.camera.projection.type' , 'orthographic' ) ;
1637
1660
} )
1638
1661
. then ( function ( ) {
1639
1662
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1640
- } )
1641
- . then ( function ( ) {
1642
- return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1643
- } )
1644
- . then ( function ( ) {
1663
+
1664
+ selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1645
1665
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1646
- } )
1647
- . then ( function ( ) {
1648
- return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1649
- } )
1650
- . then ( function ( ) {
1666
+
1667
+ selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1651
1668
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1652
1669
} )
1653
1670
. catch ( failTest )
@@ -1681,23 +1698,16 @@ describe('Test gl3d relayout calls', function() {
1681
1698
} )
1682
1699
. then ( function ( ) {
1683
1700
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( true , 'orthographic' ) ;
1684
- } )
1685
- . then ( function ( ) {
1701
+
1686
1702
return Plotly . relayout ( gd , 'scene.camera.projection.type' , 'perspective' ) ;
1687
1703
} )
1688
1704
. then ( function ( ) {
1689
1705
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1690
- } )
1691
- . then ( function ( ) {
1692
- return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1693
- } )
1694
- . then ( function ( ) {
1706
+
1707
+ selectButton ( gd . _fullLayout . _modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
1695
1708
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1696
- } )
1697
- . then ( function ( ) {
1698
- return selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1699
- } )
1700
- . then ( function ( ) {
1709
+
1710
+ selectButton ( gd . _fullLayout . _modeBar , 'resetCameraDefault3d' ) . click ( ) ;
1701
1711
expect ( gd . _fullLayout . scene . _scene . camera . _ortho ) . toEqual ( false , 'perspective' ) ;
1702
1712
} )
1703
1713
. catch ( failTest )
0 commit comments