fix(router): do not prepend the root URL with a starting slash
This commit is contained in:
parent
6834c4992d
commit
e372cc779d
|
@ -21,7 +21,7 @@ export class Location {
|
|||
normalize(url: string): string { return this._stripBaseHref(stripIndexHtml(url)); }
|
||||
|
||||
normalizeAbsolutely(url: string): string {
|
||||
if (url[0] != '/') {
|
||||
if (url.length > 0 && url[0] != '/') {
|
||||
url = '/' + url;
|
||||
}
|
||||
return this._addBaseHref(url);
|
||||
|
|
|
@ -35,6 +35,9 @@ export function main() {
|
|||
.toHaveBeenCalledWith(null, '', '/my/app/user/btford');
|
||||
});
|
||||
|
||||
it('should not prepend urls with starting slash when an empty URL is provided',
|
||||
() => { expect(location.normalizeAbsolutely('')).toEqual(browserLocation.baseHref); });
|
||||
|
||||
it('should not append urls with leading slash on navigate', () => {
|
||||
location.go('/my/app/user/btford');
|
||||
expect(browserLocation.spy('pushState'))
|
||||
|
|
Loading…
Reference in New Issue