File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -882,7 +882,7 @@ function $LocationProvider() {
882
882
883
883
884
884
// rewrite hashbang url <> html5 url
885
- if ( $location . absUrl ( ) != initialUrl ) {
885
+ if ( trimEmptyHash ( $location . absUrl ( ) ) != trimEmptyHash ( initialUrl ) ) {
886
886
$browser . url ( $location . absUrl ( ) , true ) ;
887
887
}
888
888
Original file line number Diff line number Diff line change @@ -673,6 +673,16 @@ describe('$location', function() {
673
673
} ) ) ;
674
674
} ) ;
675
675
676
+ describe ( 'rewrite hashbang url <> html5 url' , function ( ) {
677
+ beforeEach ( initService ( { html5Mode : true , supportHistory : true } ) ) ;
678
+ beforeEach ( inject ( initBrowser ( { url :'http://new.com/#' , basePath : '/' } ) ) ) ;
679
+
680
+ it ( 'should not replace browser url if only the empty hash fragment is cleared' , inject ( function ( $browser , $location ) {
681
+ expect ( $browser . url ( ) ) . toBe ( 'http://new.com/#' ) ;
682
+ expect ( $location . absUrl ( ) ) . toBe ( 'http://new.com/' ) ;
683
+ } ) ) ;
684
+ } ) ;
685
+
676
686
describe ( 'wiring' , function ( ) {
677
687
678
688
beforeEach ( initService ( { html5Mode :false , hashPrefix : '!' , supportHistory : true } ) ) ;
You can’t perform that action at this time.
0 commit comments