@@ -229,7 +229,7 @@ describe('Test gl plot interactions', function() {
229229 } ) ;
230230
231231 describe ( 'gl3d modebar click handlers' , function ( ) {
232- var modeBar ;
232+ var modeBar , relayoutCallback ;
233233
234234 beforeEach ( function ( done ) {
235235 var mockData = [ {
@@ -245,8 +245,13 @@ describe('Test gl plot interactions', function() {
245245
246246 gd = createGraphDiv ( ) ;
247247 Plotly . plot ( gd , mockData , mockLayout ) . then ( function ( ) {
248+
248249 modeBar = gd . _fullLayout . _modeBar ;
249250
251+ relayoutCallback = jasmine . createSpy ( 'relayoutCallback' ) ;
252+
253+ gd . on ( 'plotly_relayout' , relayoutCallback ) ;
254+
250255 delay ( done ) ;
251256 } ) ;
252257 } ) ;
@@ -342,7 +347,16 @@ describe('Test gl plot interactions', function() {
342347 . toEqual ( { x : 2.5 , y : 2.5 , z : 2.5 } ) ;
343348
344349 selectButton ( modeBar , 'resetCameraDefault3d' ) . click ( ) ;
350+
345351 setTimeout ( function ( ) {
352+
353+ expect ( relayoutCallback ) . toHaveBeenCalled ( ) ; // initiator: resetCameraDefault3d
354+ expect ( relayoutCallback ) . toHaveBeenCalledWith ( [
355+ [ 1.25 , 1.25 , 1.25 ] ,
356+ [ 0 , 0 , 0 ] ,
357+ [ 0 , 0 , 1 ]
358+ ] ) ;
359+
346360 expect ( sceneLayout . camera . eye )
347361 . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
348362 expect ( scene . camera . eye )
@@ -353,7 +367,16 @@ describe('Test gl plot interactions', function() {
353367 . toBeCloseToArray ( [ 1.25 , 1.25 , 1.25 ] , 4 ) ;
354368
355369 selectButton ( modeBar , 'resetCameraLastSave3d' ) . click ( ) ;
370+
356371 setTimeout ( function ( ) {
372+
373+ expect ( relayoutCallback ) . toHaveBeenCalled ( ) ; // initiator: resetCameraLastSave3d
374+ expect ( relayoutCallback ) . toHaveBeenCalledWith ( [
375+ [ 1.25 , 1.25 , 1.25 ] ,
376+ [ 0 , 0 , 0 ] ,
377+ [ 0 , 0 , 1 ]
378+ ] ) ; // looks like there's no real saved data so it reverts to default
379+
357380 expect ( sceneLayout . camera . eye )
358381 . toEqual ( { x : 0.1 , y : 0.1 , z : 1 } , 'does not change the layout objects' ) ;
359382 expect ( scene . camera . eye )
@@ -364,7 +387,9 @@ describe('Test gl plot interactions', function() {
364387 . toBeCloseToArray ( [ 2.5 , 2.5 , 2.5 ] , 4 ) ;
365388
366389 done ( ) ;
390+
367391 } , MODEBAR_DELAY ) ;
392+
368393 } , MODEBAR_DELAY ) ;
369394 } ) ;
370395 } ) ;
0 commit comments