@@ -1097,6 +1097,11 @@ describe('Test gl3d drag and wheel interactions', function() {
1097
1097
}
1098
1098
} ;
1099
1099
1100
+ function _assertAndReset ( cnt ) {
1101
+ expect ( relayoutCallback ) . toHaveBeenCalledTimes ( cnt ) ;
1102
+ relayoutCallback . calls . reset ( ) ;
1103
+ }
1104
+
1100
1105
Plotly . plot ( gd , mock )
1101
1106
. then ( function ( ) {
1102
1107
relayoutCallback = jasmine . createSpy ( 'relayoutCallback' ) ;
@@ -1115,48 +1120,32 @@ describe('Test gl3d drag and wheel interactions', function() {
1115
1120
return scroll ( sceneTarget ) ;
1116
1121
} )
1117
1122
. then ( function ( ) {
1118
- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1119
- relayoutCallback . calls . reset ( ) ;
1120
-
1123
+ _assertAndReset ( 1 ) ;
1121
1124
return scroll ( sceneTarget2 ) ;
1122
1125
} )
1123
1126
. then ( function ( ) {
1124
- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1125
- relayoutCallback . calls . reset ( ) ;
1126
-
1127
+ _assertAndReset ( 1 ) ;
1127
1128
return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
1128
1129
} )
1129
1130
. then ( function ( ) {
1130
- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1131
- relayoutCallback . calls . reset ( ) ;
1132
-
1131
+ _assertAndReset ( 1 ) ;
1133
1132
return drag ( sceneTarget , [ 0 , 0 ] , [ 100 , 100 ] ) ;
1134
1133
} )
1135
1134
. 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 } ) ;
1143
1137
} )
1144
1138
. then ( function ( ) {
1145
- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
1146
- relayoutCallback . calls . reset ( ) ;
1147
-
1139
+ _assertAndReset ( 1 ) ;
1148
1140
return drag ( sceneTarget , [ 0 , 0 ] , [ 100 , 100 ] ) ;
1149
1141
} )
1150
1142
. then ( function ( ) {
1151
1143
return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
1152
1144
} )
1153
1145
. then ( function ( ) {
1154
- expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 0 ) ;
1146
+ _assertAndReset ( 0 ) ;
1155
1147
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' } ) ;
1160
1149
} )
1161
1150
. then ( function ( ) {
1162
1151
expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -1168,7 +1157,27 @@ describe('Test gl3d drag and wheel interactions', function() {
1168
1157
return drag ( sceneTarget2 , [ 0 , 0 ] , [ 100 , 100 ] ) ;
1169
1158
} )
1170
1159
. 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 ) ;
1172
1181
} )
1173
1182
. catch ( failTest )
1174
1183
. then ( done ) ;
0 commit comments