File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ var click = require('../assets/click');
99var mouseEvent = require ( '../assets/mouse_event' ) ;
1010var failTest = require ( '../assets/fail_test' ) ;
1111var delay = require ( '../assets/delay' ) ;
12+
1213var RESIZE_DELAY = 300 ;
1314
1415describe ( 'config argument' , function ( ) {
@@ -812,5 +813,41 @@ describe('config argument', function() {
812813 . catch ( failTest )
813814 . then ( done ) ;
814815 } ) ;
816+
817+ it ( 'should not disable scrollZoom when page is made scrollable by large graph' , function ( done ) {
818+ gd = document . createElement ( 'div' ) ;
819+ gd . id = 'graph' ;
820+ document . body . appendChild ( gd ) ;
821+
822+ // locking down fix for:
823+ // https://github.com/plotly/plotly.js/issues/2371
824+
825+ var xrng0 ;
826+ var yrng0 ;
827+
828+ Plotly . newPlot ( gd , [ {
829+ y : [ 1 , 2 , 1 ]
830+ } ] , {
831+ width : 2 * window . innerWidth
832+ } , {
833+ scrollZoom : true
834+ } )
835+ . then ( function ( ) {
836+ xrng0 = gd . _fullLayout . xaxis . range . slice ( ) ;
837+ yrng0 = gd . _fullLayout . yaxis . range . slice ( ) ;
838+ } )
839+ . then ( _scroll )
840+ . then ( function ( ) {
841+ var xrng = gd . _fullLayout . xaxis . range ;
842+ expect ( xrng [ 0 ] ) . toBeGreaterThan ( xrng0 [ 0 ] , 'scrolled x-range[0]' ) ;
843+ expect ( xrng [ 1 ] ) . toBeLessThan ( xrng0 [ 1 ] , 'scrolled x-range[1]' ) ;
844+
845+ var yrng = gd . _fullLayout . yaxis . range ;
846+ expect ( yrng [ 0 ] ) . toBeGreaterThan ( yrng0 [ 0 ] , 'scrolled y-range[0]' ) ;
847+ expect ( yrng [ 1 ] ) . toBeLessThan ( yrng0 [ 1 ] , 'scrolled y-range[1]' ) ;
848+ } )
849+ . catch ( failTest )
850+ . then ( done ) ;
851+ } ) ;
815852 } ) ;
816853} ) ;
You can’t perform that action at this time.
0 commit comments