@@ -413,6 +413,53 @@ describe('Test gl plot interactions', function() {
413413 } ) ;
414414 } ) ;
415415
416+ describe ( 'drag and wheel interactions' , function ( ) {
417+ it ( 'should update the scene camera' , function ( done ) {
418+ var sceneLayout = gd . _fullLayout . scene ,
419+ sceneLayout2 = gd . _fullLayout . scene2 ,
420+ sceneTarget = gd . querySelector ( '.svg-container .gl-container #scene canvas' ) ,
421+ sceneTarget2 = gd . querySelector ( '.svg-container .gl-container #scene2 canvas' ) ;
422+
423+
424+ expect ( sceneLayout . camera . eye )
425+ . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } ) ;
426+ expect ( sceneLayout2 . camera . eye )
427+ . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
428+
429+ // Wheel scene 1
430+ sceneTarget . dispatchEvent ( new WheelEvent ( 'wheel' , { deltaY : 1 } ) ) ;
431+
432+ // Wheel scene 2
433+ sceneTarget2 . dispatchEvent ( new WheelEvent ( 'wheel' , { deltaY : 1 } ) ) ;
434+
435+ setTimeout ( function ( ) {
436+
437+ expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 2 ) ;
438+
439+ relayoutCallback . calls . reset ( ) ;
440+
441+ // Drag scene 1
442+ sceneTarget . dispatchEvent ( new MouseEvent ( 'mousedown' , { x : 0 , y : 0 } ) ) ;
443+ sceneTarget . dispatchEvent ( new MouseEvent ( 'mousemove' , { x : 100 , y : 100 } ) ) ;
444+ sceneTarget . dispatchEvent ( new MouseEvent ( 'mouseup' , { x : 100 , y : 100 } ) ) ;
445+
446+ // Drag scene 2
447+ sceneTarget2 . dispatchEvent ( new MouseEvent ( 'mousedown' , { x : 0 , y : 0 } ) ) ;
448+ sceneTarget2 . dispatchEvent ( new MouseEvent ( 'mousemove' , { x : 100 , y : 100 } ) ) ;
449+ sceneTarget2 . dispatchEvent ( new MouseEvent ( 'mouseup' , { x : 100 , y : 100 } ) ) ;
450+
451+ setTimeout ( function ( ) {
452+
453+ expect ( relayoutCallback ) . toHaveBeenCalledTimes ( 2 ) ;
454+
455+ done ( ) ;
456+
457+ } , MODEBAR_DELAY ) ;
458+
459+ } , MODEBAR_DELAY ) ;
460+ } ) ;
461+ } ) ;
462+
416463 describe ( 'button hoverClosest3d' , function ( ) {
417464 it ( 'should update the scene hovermode and spikes' , function ( ) {
418465 var buttonHover = selectButton ( modeBar , 'hoverClosest3d' ) ;
0 commit comments