@@ -711,6 +711,37 @@ describe('Test click interactions:', function() {
711
711
} ) ;
712
712
} ) ;
713
713
714
+ describe ( 'scroll zoom interactions' , function ( ) {
715
+
716
+ beforeEach ( function ( done ) {
717
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout , { scrollZoom : true } ) . then ( done ) ;
718
+ } ) ;
719
+
720
+ it ( 'zooms in on scroll up' , function ( ) {
721
+
722
+ var plot = gd . _fullLayout . _plots . xy . plot ;
723
+
724
+ mouseEvent ( 'mousemove' , 400 , 250 ) ;
725
+ mouseEvent ( 'scroll' , 400 , 250 , { deltaX : 0 , deltaY : - 1000 } ) ;
726
+
727
+ var transform = plot . attr ( 'transform' ) ;
728
+
729
+ console . log ( transform ) ;
730
+
731
+ var mockEl = {
732
+ attr : function ( ) {
733
+ return transform ;
734
+ }
735
+ } ;
736
+
737
+ var translate = Lib . getTranslate ( mockEl ) ,
738
+ scale = Lib . getScale ( mockEl ) ;
739
+
740
+ expect ( [ translate . x , translate . y ] ) . toBeCloseToArray ( [ 62.841 , 99.483 ] ) ;
741
+ expect ( [ scale . x , scale . y ] ) . toBeCloseToArray ( [ 1.221 , 1.221 ] ) ;
742
+ } ) ;
743
+ } ) ;
744
+
714
745
describe ( 'pan interactions' , function ( ) {
715
746
beforeEach ( function ( done ) {
716
747
mockCopy . layout . dragmode = 'pan' ;
@@ -745,7 +776,7 @@ describe('Test click interactions:', function() {
745
776
mouseEvent ( 'mousedown' , start , start ) ;
746
777
mouseEvent ( 'mousemove' , end , end ) ;
747
778
748
- expect ( plot . attr ( 'transform' ) ) . toBe ( 'translate(250, 280)' ) ;
779
+ expect ( plot . attr ( 'transform' ) ) . toBe ( 'translate(250, 280) scale(1, 1) ' ) ;
749
780
750
781
mouseEvent ( 'mouseup' , end , end ) ;
751
782
} ) ;
0 commit comments