@@ -619,4 +619,52 @@ describe('Test click interactions:', function() {
619
619
} ) ;
620
620
621
621
} ) ;
622
+
623
+ describe ( 'zoom interactions' , function ( ) {
624
+ beforeEach ( function ( done ) {
625
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
626
+ } ) ;
627
+
628
+ it ( 'on main dragbox should update the axis ranges' , function ( done ) {
629
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( autoRangeX ) ;
630
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( autoRangeY ) ;
631
+
632
+ drag ( 100 , 100 , 400 , 300 ) . then ( function ( ) {
633
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 2.70624901 , - 0.52254561 ] ) ;
634
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ - 0.29276050 , 1.294167062 ] ) ;
635
+
636
+ return drag ( 100 , 100 , 400 , 300 ) ;
637
+ } ) . then ( function ( ) {
638
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 2.57707219 , - 1.65438061 ] ) ;
639
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ 0.172738250 , 1.230689959 ] ) ;
640
+
641
+ done ( ) ;
642
+ } ) ;
643
+ } ) ;
644
+ } ) ;
645
+
646
+ describe ( 'pan interactions' , function ( ) {
647
+ beforeEach ( function ( done ) {
648
+ mockCopy . layout . dragmode = 'pan' ;
649
+
650
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
651
+ } ) ;
652
+
653
+ it ( 'on main dragbox should update the axis ranges' , function ( done ) {
654
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( autoRangeX ) ;
655
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( autoRangeY ) ;
656
+
657
+ drag ( 100 , 100 , 400 , 300 ) . then ( function ( ) {
658
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 5.19567089 , - 0.02757284 ] ) ;
659
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ 0.595918934 , 2.976310280 ] ) ;
660
+
661
+ return drag ( 100 , 100 , 400 , 300 ) ;
662
+ } ) . then ( function ( ) {
663
+ expect ( gd . layout . xaxis . range ) . toBeCloseToArray ( [ - 7.37937429 , - 2.21127624 ] ) ;
664
+ expect ( gd . layout . yaxis . range ) . toBeCloseToArray ( [ 2.182846498 , 4.563237844 ] ) ;
665
+
666
+ done ( ) ;
667
+ } ) ;
668
+ } ) ;
669
+ } ) ;
622
670
} ) ;
0 commit comments