@@ -2141,6 +2141,31 @@ describe('$location', function() {
2141
2141
} )
2142
2142
) ;
2143
2143
2144
+ it ( 'should fire $locationChangeSuccess when browser location changes to URL which ends with #' ,
2145
+ inject ( function ( $location , $browser , $rootScope , $log ) {
2146
+ $location . url ( '/somepath' ) ;
2147
+ $rootScope . $apply ( ) ;
2148
+
2149
+ expect ( $browser . url ( ) ) . toEqual ( 'http://server/#/somepath' ) ;
2150
+ expect ( $location . url ( ) ) . toEqual ( '/somepath' ) ;
2151
+
2152
+ $rootScope . $on ( '$locationChangeStart' , function ( event , newUrl , oldUrl ) {
2153
+ $log . info ( 'start' , newUrl , oldUrl ) ;
2154
+ } ) ;
2155
+ $rootScope . $on ( '$locationChangeSuccess' , function ( event , newUrl , oldUrl ) {
2156
+ $log . info ( 'after' , newUrl , oldUrl ) ;
2157
+ } ) ;
2158
+
2159
+ $browser . url ( 'http://server/#' ) ;
2160
+ $browser . poll ( ) ;
2161
+
2162
+ expect ( $log . info . logs . shift ( ) ) .
2163
+ toEqual ( [ 'start' , 'http://server/' , 'http://server/#/somepath' ] ) ;
2164
+ expect ( $log . info . logs . shift ( ) ) .
2165
+ toEqual ( [ 'after' , 'http://server/' , 'http://server/#/somepath' ] ) ;
2166
+ } )
2167
+ ) ;
2168
+
2144
2169
it ( 'should allow redirect during browser url change' ,
2145
2170
inject ( function ( $location , $browser , $rootScope , $log ) {
2146
2171
$rootScope . $on ( '$locationChangeStart' , function ( event , newUrl , oldUrl ) {
0 commit comments