test(aio): ensure AppComponent.pageId has no search or hash

This commit is contained in:
Peter Bacon Darwin 2017-04-02 10:14:57 +01:00 committed by Pete Bacon Darwin
parent 34a1990c57
commit 92e14a36f9
1 changed files with 17 additions and 0 deletions

View File

@ -129,6 +129,23 @@ describe('AppComponent', () => {
expect(component.pageId).toEqual('home');
expect(container.properties['id']).toEqual('home');
});
it('should not be affected by changes to the query or hash', () => {
const container = fixture.debugElement.query(By.css('section.sidenav-content'));
locationService.urlSubject.next('guide/pipes');
fixture.detectChanges();
locationService.urlSubject.next('guide/other?search=http');
fixture.detectChanges();
expect(component.pageId).toEqual('guide-other');
expect(container.properties['id']).toEqual('guide-other');
locationService.urlSubject.next('guide/http#anchor-1');
fixture.detectChanges();
expect(component.pageId).toEqual('guide-http');
expect(container.properties['id']).toEqual('guide-http');
});
});
describe('currentDocument', () => {