@@ -2095,7 +2095,7 @@ describe('otherwise and state redirects', function() {
20952095} ) ;
20962096
20972097
2098- describe ( 'hook redirects ' , function ( ) {
2098+ describe ( 'transition hook ' , function ( ) {
20992099 var log , resolvelog ;
21002100 beforeEach ( module ( function ( $stateProvider , $urlRouterProvider ) {
21012101 log = resolvelog = "" ;
@@ -2118,7 +2118,7 @@ describe('hook redirects', function() {
21182118 } ) ) ;
21192119
21202120 // Test for #2455
2121- it ( "from .otherwise() should go to the redirect-to target state and url" , inject ( function ( $transitions , $q , $state , $location ) {
2121+ it ( "redirects from .otherwise() should go to the redirect-to target state and url" , inject ( function ( $transitions , $q , $state , $location ) {
21222122 $transitions . onBefore ( { to : 'home' } , function ( ) {
21232123 return $state . target ( 'loginPage' , { } , { location : true } ) ;
21242124 } ) ;
@@ -2128,7 +2128,7 @@ describe('hook redirects', function() {
21282128 } ) ) ;
21292129
21302130 // Test for #2537
2131- it ( "should be able to change option.reload" , inject ( function ( $transitions , $q , $state , $trace ) {
2131+ it ( "redirects should be able to change option.reload" , inject ( function ( $transitions , $q , $state , $trace ) {
21322132 var count = 0 ;
21332133 $q . flush ( ) ;
21342134 expect ( $state . current . name ) . toBe ( "home" ) ;
@@ -2151,7 +2151,7 @@ describe('hook redirects', function() {
21512151 } ) ) ;
21522152
21532153 // Test for #2539
2154- it ( "should re-resolve when reloading during a redirect" , inject ( function ( $transitions , $q , $state , $trace ) {
2154+ it ( "redirects should re-resolve when reloading during a redirect" , inject ( function ( $transitions , $q , $state , $trace ) {
21552155 var count = 0 ;
21562156 $q . flush ( ) ;
21572157
@@ -2173,4 +2173,14 @@ describe('hook redirects', function() {
21732173 expect ( $state . current . name ) . toBe ( "home" ) ;
21742174 expect ( resolvelog ) . toBe ( "fooResolve;fooResolve;" ) ;
21752175 } ) ) ;
2176+
2177+ // Test for #2611
2178+ it ( "aborts should reset the URL to the prevous state's" , inject ( function ( $transitions , $q , $state , $location ) {
2179+ $q . flush ( ) ;
2180+ $transitions . onStart ( { to : 'home.foo' } , function ( ) { return false ; } ) ;
2181+ $location . path ( '/home/foo' ) ; $q . flush ( ) ;
2182+ expect ( $state . current . name ) . toBe ( "home" ) ;
2183+ expect ( $location . path ( ) ) . toBe ( '/home' ) ;
2184+ } ) ) ;
2185+
21762186} ) ;
0 commit comments