@@ -26,13 +26,13 @@ describe('$route', function() {
26
26
$routeProvider . when ( '/Blank' , { } ) ;
27
27
} ) ;
28
28
inject ( function ( $route , $location , $rootScope ) {
29
- $rootScope . $on ( '$beforeRouteChange ' , function ( event , next , current ) {
29
+ $rootScope . $on ( '$routeChangeStart ' , function ( event , next , current ) {
30
30
log += 'before();' ;
31
31
expect ( current ) . toBe ( $route . current ) ;
32
32
lastRoute = current ;
33
33
nextRoute = next ;
34
34
} ) ;
35
- $rootScope . $on ( '$afterRouteChange ' , function ( event , current , last ) {
35
+ $rootScope . $on ( '$routeChangeSuccess ' , function ( event , current , last ) {
36
36
log += 'after();' ;
37
37
expect ( current ) . toBe ( $route . current ) ;
38
38
expect ( lastRoute ) . toBe ( last ) ;
@@ -93,7 +93,7 @@ describe('$route', function() {
93
93
inject ( function ( $route , $location , $rootScope ) {
94
94
var callback = jasmine . createSpy ( 'onRouteChange' ) ;
95
95
96
- $rootScope . $on ( '$beforeRouteChange ' , callback ) ;
96
+ $rootScope . $on ( '$routeChangeStart ' , callback ) ;
97
97
$location . path ( '/test' ) ;
98
98
$rootScope . $digest ( ) ;
99
99
callback . reset ( ) ;
@@ -114,7 +114,7 @@ describe('$route', function() {
114
114
inject ( function ( $route , $location , $rootScope ) {
115
115
var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
116
116
117
- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
117
+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
118
118
expect ( $route . current ) . toBeUndefined ( ) ;
119
119
expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
120
120
@@ -139,7 +139,7 @@ describe('$route', function() {
139
139
inject ( function ( $route , $location , $rootScope ) {
140
140
var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
141
141
142
- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
142
+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
143
143
expect ( $route . current ) . toBeUndefined ( ) ;
144
144
expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
145
145
@@ -188,8 +188,8 @@ describe('$route', function() {
188
188
} ) ;
189
189
190
190
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 ) ;
193
193
194
194
$rootScope . $digest ( ) ;
195
195
expect ( routeChangeSpy ) . not . toHaveBeenCalled ( ) ;
@@ -200,7 +200,7 @@ describe('$route', function() {
200
200
} ) ;
201
201
} ) ;
202
202
203
- it ( 'should fire $beforeRouteChange and resolve promises' , function ( ) {
203
+ it ( 'should fire $routeChangeStart and resolve promises' , function ( ) {
204
204
var deferA ,
205
205
deferB ;
206
206
@@ -253,8 +253,13 @@ describe('$route', function() {
253
253
inject ( function ( $location , $route , $rootScope ) {
254
254
var log = '' ;
255
255
256
+ < << << << HEAD
256
257
$rootScope . $on ( '$beforeRouteChange' , function ( ) { log += 'before();' ; } ) ;
257
258
$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
258
263
259
264
$location . path ( '/path' ) ;
260
265
$rootScope . $digest ( ) ;
@@ -276,8 +281,8 @@ describe('$route', function() {
276
281
277
282
inject ( function ( $route , $httpBackend , $location , $rootScope ) {
278
283
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 + ');' } ) ;
281
286
282
287
$httpBackend . expectGET ( 'r1.html' ) . respond ( 'R1' ) ;
283
288
$httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -297,7 +302,7 @@ describe('$route', function() {
297
302
} ) ;
298
303
299
304
300
- it ( 'should not update $routeParams until $afterRouteChange ' , function ( ) {
305
+ it ( 'should not update $routeParams until $routeChangeSuccess ' , function ( ) {
301
306
module ( function ( $routeProvider ) {
302
307
$routeProvider .
303
308
when ( '/r1/:id' , { template : 'r1.html' } ) .
@@ -306,8 +311,8 @@ describe('$route', function() {
306
311
307
312
inject ( function ( $route , $httpBackend , $location , $rootScope , $routeParams ) {
308
313
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 ) + ';' } ) ;
311
316
312
317
$httpBackend . whenGET ( 'r1.html' ) . respond ( 'R1' ) ;
313
318
$httpBackend . whenGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -338,8 +343,8 @@ describe('$route', function() {
338
343
339
344
inject ( function ( $route , $httpBackend , $location , $rootScope ) {
340
345
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 + ');' } ) ;
343
348
344
349
$httpBackend . expectGET ( 'r1.html' ) . respond ( 'R1' ) ;
345
350
$httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -371,8 +376,8 @@ describe('$route', function() {
371
376
$rootScope . $on ( '$routeChangeError' , function ( e , next , last , error ) {
372
377
log += '$failed(' + next . templateUrl + ', ' + error . status + ');' ;
373
378
} ) ;
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 + ');' } ) ;
376
381
377
382
$httpBackend . expectGET ( 'r1.html' ) . respond ( 404 , 'R1' ) ;
378
383
$httpBackend . expectGET ( 'r2.html' ) . respond ( 'R2' ) ;
@@ -457,7 +462,7 @@ describe('$route', function() {
457
462
inject ( function ( $route , $location , $rootScope ) {
458
463
var onChangeSpy = jasmine . createSpy ( 'onChange' ) ;
459
464
460
- $rootScope . $on ( '$beforeRouteChange ' , onChangeSpy ) ;
465
+ $rootScope . $on ( '$routeChangeStart ' , onChangeSpy ) ;
461
466
expect ( $route . current ) . toBeUndefined ( ) ;
462
467
expect ( onChangeSpy ) . not . toHaveBeenCalled ( ) ;
463
468
@@ -563,7 +568,7 @@ describe('$route', function() {
563
568
} ) ;
564
569
565
570
inject ( function ( $route , $location , $rootScope , $routeParams ) {
566
- $rootScope . $on ( '$beforeRouteChange ' , reloaded ) ;
571
+ $rootScope . $on ( '$routeChangeStart ' , reloaded ) ;
567
572
$location . path ( '/foo' ) ;
568
573
$rootScope . $digest ( ) ;
569
574
expect ( reloaded ) . toHaveBeenCalled ( ) ;
@@ -588,8 +593,8 @@ describe('$route', function() {
588
593
} ) ;
589
594
590
595
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 ) ;
593
598
$rootScope . $on ( '$routeUpdate' , routeUpdate ) ;
594
599
595
600
expect ( routeChange ) . not . toHaveBeenCalled ( ) ;
@@ -618,8 +623,8 @@ describe('$route', function() {
618
623
} ) ;
619
624
620
625
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 ) ;
623
628
624
629
expect ( routeChange ) . not . toHaveBeenCalled ( ) ;
625
630
@@ -693,7 +698,7 @@ describe('$route', function() {
693
698
} ) ;
694
699
695
700
inject ( function ( $route , $location , $rootScope , $routeParams ) {
696
- $rootScope . $on ( '$afterRouteChange ' , routeChangeSpy ) ;
701
+ $rootScope . $on ( '$routeChangeSuccess ' , routeChangeSpy ) ;
697
702
698
703
$location . path ( '/bar/123' ) ;
699
704
$rootScope . $digest ( ) ;
0 commit comments