@@ -211,6 +211,58 @@ describe('Test gl plot interactions', function() {
211
211
212
212
} ) ;
213
213
214
+ describe ( 'gl3d plots' , function ( ) {
215
+
216
+ var mock = require ( '@mocks/gl3d_scatter3d-connectgaps.json' ) ,
217
+ modeBar , relayoutCallback ;
218
+
219
+ beforeEach ( function ( done ) {
220
+ gd = createGraphDiv ( ) ;
221
+
222
+ Plotly . plot ( gd , mock . data , mock . layout ) . then ( function ( ) {
223
+
224
+ modeBar = gd . _fullLayout . _modeBar ;
225
+ relayoutCallback = jasmine . createSpy ( 'relayoutCallback' ) ;
226
+
227
+ gd . on ( 'plotly_relayout' , relayoutCallback ) ;
228
+
229
+ delay ( done ) ;
230
+ } ) ;
231
+ } ) ;
232
+
233
+ it ( 'should respond to drag interactions' , function ( done ) {
234
+
235
+ // Expected shape of projection-related data
236
+ var cameraStructure = {
237
+ up : { x : jasmine . any ( Number ) , y : jasmine . any ( Number ) , z : jasmine . any ( Number ) } ,
238
+ center : { x : jasmine . any ( Number ) , y : jasmine . any ( Number ) , z : jasmine . any ( Number ) } ,
239
+ eye : { x : jasmine . any ( Number ) , y : jasmine . any ( Number ) , z : jasmine . any ( Number ) }
240
+ } ;
241
+
242
+ setTimeout ( function ( ) {
243
+
244
+ // One 'drag': simulating fairly thoroughly as the mouseup event is also needed here
245
+ mouseEvent ( 'mousemove' , 400 , 200 ) ;
246
+ mouseEvent ( 'mousedown' , 400 , 200 ) ;
247
+ mouseEvent ( 'mousemove' , 320 , 320 , { buttons : 1 } ) ;
248
+ mouseEvent ( 'mouseup' , 320 , 320 ) ;
249
+
250
+ // Check event emission count
251
+ expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 1 ) ;
252
+
253
+ // Check structure of event callback value contents
254
+ expect ( relayoutCallback ) . toHaveBeenCalledWith ( jasmine . objectContaining ( { scene : cameraStructure } ) ) ;
255
+
256
+ // Check camera contents on the DIV layout
257
+ var divCamera = gd . layout . scene . camera ;
258
+ expect ( divCamera ) . toEqual ( cameraStructure ) ;
259
+
260
+ delay ( done ) ;
261
+
262
+ } , MODEBAR_DELAY ) ;
263
+ } ) ;
264
+ } ) ;
265
+
214
266
describe ( 'gl2d plots' , function ( ) {
215
267
var mock = require ( '@mocks/gl2d_10.json' ) ,
216
268
modeBar , relayoutCallback ;
0 commit comments