File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export class Location {
2121 normalize ( url : string ) : string { return this . _stripBaseHref ( stripIndexHtml ( url ) ) ; }
2222
2323 normalizeAbsolutely ( url : string ) : string {
24- if ( url [ 0 ] != '/' ) {
24+ if ( url . length > 0 && url [ 0 ] != '/' ) {
2525 url = '/' + url ;
2626 }
2727 return this . _addBaseHref ( url ) ;
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ export function main() {
3535 . toHaveBeenCalledWith ( null , '' , '/my/app/user/btford' ) ;
3636 } ) ;
3737
38+ it ( 'should not prepend urls with starting slash when an empty URL is provided' ,
39+ ( ) => { expect ( location . normalizeAbsolutely ( '' ) ) . toEqual ( browserLocation . baseHref ) ; } ) ;
40+
3841 it ( 'should not append urls with leading slash on navigate' , ( ) => {
3942 location . go ( '/my/app/user/btford' ) ;
4043 expect ( browserLocation . spy ( 'pushState' ) )
You can’t perform that action at this time.
0 commit comments