@@ -1097,6 +1097,11 @@ describe('Test gl3d drag and wheel interactions', function() {
10971097 }
10981098 } ;
10991099
1100+ function _assertAndReset ( cnt ) {
1101+ expect ( relayoutCallback ) . toHaveBeenCalledTimes ( cnt ) ;
1102+ relayoutCallback . calls . reset ( ) ;
1103+ }
1104+
11001105 Plotly . plot ( gd , mock )
11011106 . then ( function ( ) {
11021107 relayoutCallback = jasmine . createSpy ( 'relayoutCallback' ) ;
@@ -1115,48 +1120,32 @@ describe('Test gl3d drag and wheel interactions', function() {
11151120 return scroll ( sceneTarget ) ;
11161121 } )
11171122 . then ( function ( ) {
1118- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1119- relayoutCallback . calls . reset ( ) ;
1120-
1123+ _assertAndReset ( 1 ) ;
11211124 return scroll ( sceneTarget2 ) ;
11221125 } )
11231126 . then ( function ( ) {
1124- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1125- relayoutCallback . calls . reset ( ) ;
1126-
1127+ _assertAndReset ( 1 ) ;
11271128 return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
11281129 } )
11291130 . then ( function ( ) {
1130- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1131- relayoutCallback . calls . reset ( ) ;
1132-
1131+ _assertAndReset ( 1 ) ;
11331132 return drag ( sceneTarget , [ 0 , 0 ] , [ 100 , 100 ] ) ;
11341133 } )
11351134 . then ( function ( ) {
1136- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1137- relayoutCallback . calls . reset ( ) ;
1138-
1139- return Plotly . relayout ( gd , {
1140- 'scene.dragmode' : false ,
1141- 'scene2.dragmode' : false
1142- } ) ;
1135+ _assertAndReset ( 1 ) ;
1136+ return Plotly . relayout ( gd , { 'scene.dragmode' : false , 'scene2.dragmode' : false } ) ;
11431137 } )
11441138 . then ( function ( ) {
1145- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1146- relayoutCallback . calls . reset ( ) ;
1147-
1139+ _assertAndReset ( 1 ) ;
11481140 return drag ( sceneTarget , [ 0 , 0 ] , [ 100 , 100 ] ) ;
11491141 } )
11501142 . then ( function ( ) {
11511143 return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
11521144 } )
11531145 . then ( function ( ) {
1154- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 0 ) ;
1146+ _assertAndReset ( 0 ) ;
11551147
1156- return Plotly . relayout ( gd , {
1157- 'scene.dragmode' : 'orbit' ,
1158- 'scene2.dragmode' : 'turntable'
1159- } ) ;
1148+ return Plotly . relayout ( gd , { 'scene.dragmode' : 'orbit' , 'scene2.dragmode' : 'turntable' } ) ;
11601149 } )
11611150 . then ( function ( ) {
11621151 expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1168,7 +1157,27 @@ describe('Test gl3d drag and wheel interactions', function() {
11681157 return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
11691158 } )
11701159 . then ( function ( ) {
1171- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 2 ) ;
1160+ _assertAndReset ( 2 ) ;
1161+ return Plotly . plot ( gd , [ ] , { } , { scrollZoom : false } ) ;
1162+ } )
1163+ . then ( function ( ) {
1164+ return scroll ( sceneTarget ) ;
1165+ } )
1166+ . then ( function ( ) {
1167+ return scroll ( sceneTarget2 ) ;
1168+ } )
1169+ . then ( function ( ) {
1170+ _assertAndReset ( 0 ) ;
1171+ return Plotly . plot ( gd , [ ] , { } , { scrollZoom : 'gl3d' } ) ;
1172+ } )
1173+ . then ( function ( ) {
1174+ return scroll ( sceneTarget ) ;
1175+ } )
1176+ . then ( function ( ) {
1177+ return scroll ( sceneTarget2 ) ;
1178+ } )
1179+ . then ( function ( ) {
1180+ _assertAndReset ( 2 ) ;
11721181 } )
11731182 . catch ( failTest )
11741183 . then ( done ) ;
0 commit comments