@@ -711,6 +711,37 @@ describe('Test click interactions:', function() {
711711 } ) ;
712712 } ) ;
713713
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+
714745 describe ( 'pan interactions' , function ( ) {
715746 beforeEach ( function ( done ) {
716747 mockCopy . layout . dragmode = 'pan' ;
@@ -745,7 +776,7 @@ describe('Test click interactions:', function() {
745776 mouseEvent ( 'mousedown' , start , start ) ;
746777 mouseEvent ( 'mousemove' , end , end ) ;
747778
748- expect ( plot . attr ( 'transform' ) ) . toBe ( 'translate(250, 280)' ) ;
779+ expect ( plot . attr ( 'transform' ) ) . toBe ( 'translate(250, 280) scale(1, 1) ' ) ;
749780
750781 mouseEvent ( 'mouseup' , end , end ) ;
751782 } ) ;
0 commit comments