@@ -296,12 +296,15 @@ describe('NavigationController', () => {
296296 } ) ;
297297 } ) ;
298298 it ( 'sets the completion callback' , ( ) => {
299- controller . __transitionViews ( null , ( ) => { } ) ;
299+ controller . __transitionViews ( { } ) ;
300300 expect ( controller . __transitionViewsComplete ) . to . be . a ( 'function' ) ;
301301 } ) ;
302302 it ( 'sets and calls the completion callback' , ( done ) => {
303303 const transitionCallbackSpy = sinon . spy ( ) ;
304- controller . __transitionViews ( Transition . type . NONE , transitionCallbackSpy ) ;
304+ controller . __transitionViews ( {
305+ transition : Transition . type . NONE ,
306+ onComplete : transitionCallbackSpy
307+ } ) ;
305308 const transitionCompleteSpy = sinon . spy ( controller , '__transitionViewsComplete' ) ;
306309 requestAnimationFrame ( ( ) => {
307310 expect ( transitionCompleteSpy . calledOnce ) . to . be . true ;
@@ -312,7 +315,9 @@ describe('NavigationController', () => {
312315 it ( 'manually runs a "none" transition' , ( done ) => {
313316 const transformSpy = sinon . spy ( controller , '__transformViews' ) ;
314317 const animateCompleteSpy = sinon . spy ( controller , '__animateViewsComplete' ) ;
315- controller . __transitionViews ( Transition . type . NONE ) ;
318+ controller . __transitionViews ( {
319+ transition : Transition . type . NONE
320+ } ) ;
316321 const transitionCompleteSpy = sinon . spy ( controller , '__transitionViewsComplete' ) ;
317322 requestAnimationFrame ( ( ) => {
318323 expect ( transformSpy . calledOnce ) . to . be . true ;
@@ -325,26 +330,32 @@ describe('NavigationController', () => {
325330 const animateSpy = sinon . spy ( controller , '__animateViews' ) ;
326331 const transformSpy = sinon . spy ( controller , '__transformViews' ) ;
327332 const animateCompleteSpy = sinon . spy ( controller , '__animateViewsComplete' ) ;
328- controller . __transitionViews ( Transition . type . PUSH_LEFT , function ( ) {
329- expect ( animateSpy . callCount ) . to . be . above ( 1 ) ;
330- expect ( transformSpy . callCount ) . to . be . above ( 1 ) ;
331- expect ( animateCompleteSpy . calledOnce ) . to . be . true ;
332- done ( ) ;
333+ controller . __transitionViews ( {
334+ transition : Transition . type . PUSH_LEFT ,
335+ onComplete ( ) {
336+ expect ( animateSpy . callCount ) . to . be . above ( 1 ) ;
337+ expect ( transformSpy . callCount ) . to . be . above ( 1 ) ;
338+ expect ( animateCompleteSpy . calledOnce ) . to . be . true ;
339+ done ( ) ;
340+ }
333341 } ) ;
334342 controller . __isTransitioning = true ;
335343 } ) ;
336344 it ( 'runs a custom transtion' , ( done ) => {
337345 let _prevElement , _nextElement ;
338- controller . __transitionViews ( ( prevElement , nextElement , done ) => {
339- _prevElement = prevElement ;
340- _nextElement = nextElement ;
341- prevElement . style [ transformPrefix ] = 'translate3d(10px, 20px, 0px)' ;
342- nextElement . style [ transformPrefix ] = 'translate3d(30px, 40px, 0px)' ;
343- setTimeout ( done , 500 ) ;
344- } , ( ) => {
345- expect ( _prevElement . style [ transformPrefix ] ) . to . equal ( `translate3d(10px, 20px, 0px)` ) ;
346- expect ( _nextElement . style [ transformPrefix ] ) . to . equal ( `translate3d(30px, 40px, 0px)` ) ;
347- done ( ) ;
346+ controller . __transitionViews ( {
347+ transition ( prevElement , nextElement , done ) {
348+ _prevElement = prevElement ;
349+ _nextElement = nextElement ;
350+ prevElement . style [ transformPrefix ] = 'translate3d(10px, 20px, 0px)' ;
351+ nextElement . style [ transformPrefix ] = 'translate3d(30px, 40px, 0px)' ;
352+ setTimeout ( done , 500 ) ;
353+ } ,
354+ onComplete ( ) {
355+ expect ( _prevElement . style [ transformPrefix ] ) . to . equal ( `translate3d(10px, 20px, 0px)` ) ;
356+ expect ( _nextElement . style [ transformPrefix ] ) . to . equal ( `translate3d(30px, 40px, 0px)` ) ;
357+ done ( ) ;
358+ }
348359 } ) ;
349360 } ) ;
350361 } ) ;
0 commit comments