File tree 1 file changed +37
-0
lines changed
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');
9
9
var mouseEvent = require ( '../assets/mouse_event' ) ;
10
10
var failTest = require ( '../assets/fail_test' ) ;
11
11
var delay = require ( '../assets/delay' ) ;
12
+
12
13
var RESIZE_DELAY = 300 ;
13
14
14
15
describe ( 'config argument' , function ( ) {
@@ -812,5 +813,41 @@ describe('config argument', function() {
812
813
. catch ( failTest )
813
814
. then ( done ) ;
814
815
} ) ;
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
+ } ) ;
815
852
} ) ;
816
853
} ) ;
You can’t perform that action at this time.
0 commit comments