@@ -460,22 +460,30 @@ describe('NavigationController', () => {
460460 } )
461461 } ) ;
462462 it ( 'calls lifecycle events' , ( done ) => {
463- const didShowViewSpy = sinon . spy ( ) ;
463+ const willHideViewSpy = sinon . spy ( ) ;
464+ const willShowViewSpy = sinon . spy ( ) ;
464465 const didHideViewSpy = sinon . spy ( ) ;
465- controller . __pushView ( < ViewB /> , {
466- transition : Transition . type . NONE
467- } ) ;
468- controller . forceUpdate ( ( ) => {
466+ const didShowViewSpy = sinon . spy ( ) ;
467+ var stub = sinon . stub ( controller , '__transitionViews' , function ( options ) {
469468 let prevView = controller . refs [ 'view-0' ] ;
470469 let nextView = controller . refs [ 'view-1' ] ;
470+ prevView . navigationControllerWillHideView = willHideViewSpy ;
471+ nextView . navigationControllerWillShowView = willShowViewSpy ;
471472 prevView . navigationControllerDidHideView = didHideViewSpy ;
472473 nextView . navigationControllerDidShowView = didShowViewSpy ;
474+ stub . restore ( ) ;
475+ controller . __transitionViews ( options ) ;
473476 requestAnimationFrame ( ( ) => {
477+ expect ( willHideViewSpy . calledOnce ) . to . be . true ;
478+ expect ( willShowViewSpy . calledOnce ) . to . be . true ;
474479 expect ( didHideViewSpy . calledOnce ) . to . be . true ;
475480 expect ( didShowViewSpy . calledOnce ) . to . be . true ;
476481 done ( ) ;
477482 } ) ;
478483 } ) ;
484+ controller . __pushView ( < ViewB /> , {
485+ transition : Transition . type . NONE
486+ } ) ;
479487 } ) ;
480488 } ) ;
481489 describe ( '#__popView' , ( ) => {
0 commit comments