feat(aio): add id to doc-viewer container based on current url
This enables page specific styling via CSS.
This commit is contained in:

committed by
Pete Bacon Darwin

parent
97deb01b1f
commit
759af8b56b
@ -104,6 +104,33 @@ describe('AppComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('pageId', () => {
|
||||
let locationService: MockLocationService;
|
||||
|
||||
beforeEach(() => {
|
||||
locationService = fixture.debugElement.injector.get(LocationService) as any;
|
||||
});
|
||||
|
||||
it('should set the id of the doc viewer container based on the current url', () => {
|
||||
const container = fixture.debugElement.query(By.css('section.sidenav-content'));
|
||||
|
||||
locationService.urlSubject.next('guide/pipes');
|
||||
fixture.detectChanges();
|
||||
expect(component.pageId).toEqual('guide-pipes');
|
||||
expect(container.properties['id']).toEqual('guide-pipes');
|
||||
|
||||
locationService.urlSubject.next('news');
|
||||
fixture.detectChanges();
|
||||
expect(component.pageId).toEqual('news');
|
||||
expect(container.properties['id']).toEqual('news');
|
||||
|
||||
locationService.urlSubject.next('');
|
||||
fixture.detectChanges();
|
||||
expect(component.pageId).toEqual('home');
|
||||
expect(container.properties['id']).toEqual('home');
|
||||
});
|
||||
});
|
||||
|
||||
describe('currentDocument', () => {
|
||||
console.log('PENDING: AppComponent currentDocument');
|
||||
});
|
||||
|
Reference in New Issue
Block a user