From 92e14a36f9590690992cbbdc71073816f83f6d5d Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Sun, 2 Apr 2017 10:14:57 +0100 Subject: [PATCH] test(aio): ensure AppComponent.pageId has no search or hash --- aio/src/app/app.component.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 3da89a4604..effa2795e6 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -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', () => {