@@ -26,13 +26,13 @@ describe('$route', function() {
2626 $routeProvider . when ( '/Blank' , { } ) ;
2727 } ) ;
2828 inject ( function ( $route , $location , $rootScope ) {
29- $rootScope . $on ( '$beforeRouteChange ' , function ( event , next , current ) {
29+ $rootScope . $on ( '$routeChangeStart ' , function ( event , next , current ) {
3030 log += 'before();' ;
3131 expect ( current ) . toBe ( $route . current ) ;
3232 lastRoute = current ;
3333 nextRoute = next ;
3434 } ) ;
35- $rootScope . $on ( '$afterRouteChange ' , function ( event , current , last ) {
35+ $rootScope . $on ( '$routeChangeSuccess ' , function ( event , current , last ) {
3636 log += 'after();' ;
3737 expect ( current ) . toBe ( $route . current ) ;
3838 expect ( lastRoute ) . toBe ( last ) ;
@@ -93,7 +93,7 @@ describe('$route', function() {
9393 inject ( function ( $route , $location , $rootScope ) {
9494 var callback = jasmine . createSpy ( 'onRouteChange' ) ;
9595
96- $rootScope . $on ( '$beforeRouteChange ' , callback ) ;
96+ $rootScope . $on ( '$routeChangeStart ' , callback ) ;
9797 $location . path ( '/test' ) ;
9898 $rootScope . $digest ( ) ;
9999 callback . reset ( ) ;
@@ -114,7 +114,7 @@ describe('$route', function() {
114114 inject ( function ( $route , $location , $rootScope ) {
115115 var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
116116
117- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
117+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
118118 expect ( $route . current ) . toBeUndefined ( ) ;
119119 expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
120120
@@ -139,7 +139,7 @@ describe('$route', function() {
139139 inject ( function ( $route , $location , $rootScope ) {
140140 var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
141141
142- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
142+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
143143 expect ( $route . current ) . toBeUndefined ( ) ;
144144 expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
145145
@@ -188,8 +188,8 @@ describe('$route', function() {
188188 } ) ;
189189
190190 inject ( function ( $rootScope , $route , $location ) {
191- $rootScope . $on ( '$beforeRouteChange ' , routeChangeSpy ) ;
192- $rootScope . $on ( '$afterRouteChange ' , routeChangeSpy ) ;
191+ $rootScope . $on ( '$routeChangeStart ' , routeChangeSpy ) ;
192+ $rootScope . $on ( '$routeChangeSuccess ' , routeChangeSpy ) ;
193193
194194 $rootScope . $digest ( ) ;
195195 expect ( routeChangeSpy ) . not . toHaveBeenCalled ( ) ;
@@ -200,7 +200,7 @@ describe('$route', function() {
200200 } ) ;
201201 } ) ;
202202
203- it ( 'should fire $beforeRouteChange and resolve promises' , function ( ) {
203+ it ( 'should fire $routeChangeStart and resolve promises' , function ( ) {
204204 var deferA ,
205205 deferB ;
206206
@@ -253,8 +253,13 @@ describe('$route', function() {
253253 inject ( function ( $location , $route , $rootScope ) {
254254 var log = '' ;
255255
256+ < << << << HEAD
256257 $rootScope . $on ( '$beforeRouteChange' , function ( ) { log += 'before();' ; } ) ;
257258 $rootScope . $on ( '$routeChangeError' , function ( e , n , l , reason ) { log += 'failed(' + reason + ');' ; } ) ;
259+ = === ===
260+ $rootScope . $on ( '$routeChangeStart' , function ( ) { log += 'before();' ; } ) ;
261+ $rootScope . $on ( '$routeChangeFailed' , function ( e , n , l , reason ) { log += 'failed(' + reason + ');' ; } ) ;
262+ > >>> >>> ebebe46 . . . chore ( $route ) : rename events
258263
259264 $location . path ( '/path' ) ;
260265 $rootScope . $digest ( ) ;
@@ -276,8 +281,8 @@ describe('$route', function() {
276281
277282 inject ( function ( $route , $httpBackend , $location , $rootScope ) {
278283 var log = '' ;
279- $rootScope . $on ( '$beforeRouteChange ' , function ( e , next ) { log += '$before(' + next . template + ');' } ) ;
280- $rootScope . $on ( '$afterRouteChange ' , function ( e , next ) { log += '$after(' + next . template + ');' } ) ;
284+ $rootScope . $on ( '$routeChangeStart ' , function ( e , next ) { log += '$before(' + next . template + ');' } ) ;
285+ $rootScope . $on ( '$routeChangeSuccess ' , function ( e , next ) { log += '$after(' + next . template + ');' } ) ;
281286
282287 $httpBackend . expectGET ( 'r1.html' ) . respond ( 'R1' ) ;
283288 $httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -297,7 +302,7 @@ describe('$route', function() {
297302 } ) ;
298303
299304
300- it ( 'should not update $routeParams until $afterRouteChange ' , function ( ) {
305+ it ( 'should not update $routeParams until $routeChangeSuccess ' , function ( ) {
301306 module ( function ( $routeProvider ) {
302307 $routeProvider .
303308 when ( '/r1/:id' , { template : 'r1.html' } ) .
@@ -306,8 +311,8 @@ describe('$route', function() {
306311
307312 inject ( function ( $route , $httpBackend , $location , $rootScope , $routeParams ) {
308313 var log = '' ;
309- $rootScope . $on ( '$beforeRouteChange ' , function ( e , next ) { log += '$before' + toJson ( $routeParams ) + ';' } ) ;
310- $rootScope . $on ( '$afterRouteChange ' , function ( e , next ) { log += '$after' + toJson ( $routeParams ) + ';' } ) ;
314+ $rootScope . $on ( '$routeChangeStart ' , function ( e , next ) { log += '$before' + toJson ( $routeParams ) + ';' } ) ;
315+ $rootScope . $on ( '$routeChangeSuccess ' , function ( e , next ) { log += '$after' + toJson ( $routeParams ) + ';' } ) ;
311316
312317 $httpBackend . whenGET ( 'r1.html' ) . respond ( 'R1' ) ;
313318 $httpBackend . whenGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -338,8 +343,8 @@ describe('$route', function() {
338343
339344 inject ( function ( $route , $httpBackend , $location , $rootScope ) {
340345 var log = '' ;
341- $rootScope . $on ( '$beforeRouteChange ' , function ( e , next ) { log += '$before(' + next . template + ');' } ) ;
342- $rootScope . $on ( '$afterRouteChange ' , function ( e , next ) { log += '$after(' + next . template + ');' } ) ;
346+ $rootScope . $on ( '$routeChangeStart ' , function ( e , next ) { log += '$before(' + next . template + ');' } ) ;
347+ $rootScope . $on ( '$routeChangeSuccess ' , function ( e , next ) { log += '$after(' + next . template + ');' } ) ;
343348
344349 $httpBackend . expectGET ( 'r1.html' ) . respond ( 'R1' ) ;
345350 $httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -371,8 +376,8 @@ describe('$route', function() {
371376 $rootScope . $on ( '$routeChangeError' , function ( e , next , last , error ) {
372377 log += '$failed(' + next . templateUrl + ', ' + error . status + ');' ;
373378 } ) ;
374- $rootScope . $on ( '$beforeRouteChange ' , function ( e , next ) { log += '$before(' + next . templateUrl + ');' } ) ;
375- $rootScope . $on ( '$afterRouteChange ' , function ( e , next ) { log += '$after(' + next . templateUrl + ');' } ) ;
379+ $rootScope . $on ( '$routeChangeStart ' , function ( e , next ) { log += '$before(' + next . templateUrl + ');' } ) ;
380+ $rootScope . $on ( '$routeChangeSuccess ' , function ( e , next ) { log += '$after(' + next . templateUrl + ');' } ) ;
376381
377382 $httpBackend . expectGET ( 'r1.html' ) . respond ( 404 , 'R1' ) ;
378383 $httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -457,7 +462,7 @@ describe('$route', function() {
457462 inject ( function ( $route , $location , $rootScope ) {
458463 var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
459464
460- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
465+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
461466 expect ( $route . current ) . toBeUndefined ( ) ;
462467 expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
463468
@@ -563,7 +568,7 @@ describe('$route', function() {
563568 } ) ;
564569
565570 inject ( function ( $route , $location , $rootScope , $routeParams ) {
566- $rootScope . $on ( '$beforeRouteChange ' , reloaded ) ;
571+ $rootScope . $on ( '$routeChangeStart ' , reloaded ) ;
567572 $location . path ( '/foo' ) ;
568573 $rootScope . $digest ( ) ;
569574 expect ( reloaded ) . toHaveBeenCalled ( ) ;
@@ -588,8 +593,8 @@ describe('$route', function() {
588593 } ) ;
589594
590595 inject ( function ( $route , $location , $rootScope ) {
591- $rootScope . $on ( '$beforeRouteChange ' , routeChange ) ;
592- $rootScope . $on ( '$afterRouteChange ' , routeChange ) ;
596+ $rootScope . $on ( '$routeChangeStart ' , routeChange ) ;
597+ $rootScope . $on ( '$routeChangeSuccess ' , routeChange ) ;
593598 $rootScope . $on ( '$routeUpdate' , routeUpdate ) ;
594599
595600 expect ( routeChange ) . not . toHaveBeenCalled ( ) ;
@@ -618,8 +623,8 @@ describe('$route', function() {
618623 } ) ;
619624
620625 inject ( function ( $route , $location , $rootScope ) {
621- $rootScope . $on ( '$beforeRouteChange ' , routeChange ) ;
622- $rootScope . $on ( '$afterRouteChange ' , routeChange ) ;
626+ $rootScope . $on ( '$routeChangeStart ' , routeChange ) ;
627+ $rootScope . $on ( '$routeChangeSuccess ' , routeChange ) ;
623628
624629 expect ( routeChange ) . not . toHaveBeenCalled ( ) ;
625630
@@ -693,7 +698,7 @@ describe('$route', function() {
693698 } ) ;
694699
695700 inject ( function ( $route , $location , $rootScope , $routeParams ) {
696- $rootScope . $on ( '$afterRouteChange ' , routeChangeSpy ) ;
701+ $rootScope . $on ( '$routeChangeSuccess ' , routeChangeSpy ) ;
697702
698703 $location . path ( '/bar/123' ) ;
699704 $rootScope . $digest ( ) ;
0 commit comments