From b9ed97c0d95c7d02a07e4d3725356010c884f4d1 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Sat, 6 May 2017 09:30:18 +0100 Subject: [PATCH] fix(aio): do not display a Toc initially Previously the `hasToc` was initialised to true, which caused a flash of unwanted "Contents" [sic] even if the page was not going to need a ToC. Closes #16597 --- aio/src/app/embedded/toc/toc.component.spec.ts | 4 ++++ aio/src/app/embedded/toc/toc.component.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/aio/src/app/embedded/toc/toc.component.spec.ts b/aio/src/app/embedded/toc/toc.component.spec.ts index dd241847b1..1127d189e0 100644 --- a/aio/src/app/embedded/toc/toc.component.spec.ts +++ b/aio/src/app/embedded/toc/toc.component.spec.ts @@ -55,6 +55,10 @@ describe('TocComponent', () => { expect(tocComponent.isEmbedded).toEqual(true); }); + it('should not display a ToC initially', () => { + expect(tocComponent.hasToc).toBe(false); + }); + it('should not display anything when no TocItems', () => { tocService.tocList.next([]); fixture.detectChanges(); diff --git a/aio/src/app/embedded/toc/toc.component.ts b/aio/src/app/embedded/toc/toc.component.ts index 504ebb33ac..2bf96c93ee 100644 --- a/aio/src/app/embedded/toc/toc.component.ts +++ b/aio/src/app/embedded/toc/toc.component.ts @@ -12,7 +12,7 @@ import { TocItem, TocService } from 'app/shared/toc.service'; export class TocComponent implements OnInit, OnDestroy { hasSecondary = false; - hasToc = true; + hasToc = false; isClosed = true; isEmbedded = false; private primaryMax = 4;