fix(platform-server): default unspecified sections of the url to empty string (#14512)

This commit is contained in:
Alex Rickabaugh
2017-02-16 10:18:55 -08:00
committed by Igor Minar
parent 4a56b6e7f6
commit 612f120208
2 changed files with 23 additions and 2 deletions

View File

@ -185,6 +185,19 @@ export function main() {
expect(location.hash).toBe('#hash');
});
});
it('handles empty search and hash portions of the url', () => {
platformDynamicServer([{
provide: INITIAL_CONFIG,
useValue: {document: '<app></app>', url: 'http://test.com/deep/path'}
}])
.bootstrapModule(ExampleModule)
.then(appRef => {
const location: PlatformLocation = appRef.injector.get(PlatformLocation);
expect(location.pathname).toBe('/deep/path');
expect(location.search).toBe('');
expect(location.hash).toBe('');
});
});
it('pushState causes the URL to update', async(() => {
const platform = platformDynamicServer(
[{provide: INITIAL_CONFIG, useValue: {document: '<app></app>'}}]);