@@ -2095,7 +2095,7 @@ describe('otherwise and state redirects', function() {
2095
2095
} ) ;
2096
2096
2097
2097
2098
- describe ( 'hook redirects ' , function ( ) {
2098
+ describe ( 'transition hook ' , function ( ) {
2099
2099
var log , resolvelog ;
2100
2100
beforeEach ( module ( function ( $stateProvider , $urlRouterProvider ) {
2101
2101
log = resolvelog = "" ;
@@ -2118,7 +2118,7 @@ describe('hook redirects', function() {
2118
2118
} ) ) ;
2119
2119
2120
2120
// 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 ) {
2122
2122
$transitions . onBefore ( { to : 'home' } , function ( ) {
2123
2123
return $state . target ( 'loginPage' , { } , { location : true } ) ;
2124
2124
} ) ;
@@ -2128,7 +2128,7 @@ describe('hook redirects', function() {
2128
2128
} ) ) ;
2129
2129
2130
2130
// 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 ) {
2132
2132
var count = 0 ;
2133
2133
$q . flush ( ) ;
2134
2134
expect ( $state . current . name ) . toBe ( "home" ) ;
@@ -2151,7 +2151,7 @@ describe('hook redirects', function() {
2151
2151
} ) ) ;
2152
2152
2153
2153
// 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 ) {
2155
2155
var count = 0 ;
2156
2156
$q . flush ( ) ;
2157
2157
@@ -2173,4 +2173,14 @@ describe('hook redirects', function() {
2173
2173
expect ( $state . current . name ) . toBe ( "home" ) ;
2174
2174
expect ( resolvelog ) . toBe ( "fooResolve;fooResolve;" ) ;
2175
2175
} ) ) ;
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
+
2176
2186
} ) ;
0 commit comments