diff --git a/aio/src/app/app.component.html b/aio/src/app/app.component.html index 4f37a04fe0..9aacb38ba0 100644 --- a/aio/src/app/app.component.html +++ b/aio/src/app/app.component.html @@ -24,7 +24,7 @@
- +
diff --git a/aio/src/app/embedded/toc/toc.component.html b/aio/src/app/embedded/toc/toc.component.html index 344da3ca5a..079952d615 100644 --- a/aio/src/app/embedded/toc/toc.component.html +++ b/aio/src/app/embedded/toc/toc.component.html @@ -1,7 +1,7 @@
Contents

Table of Contents

diff --git a/aio/src/app/embedded/toc/toc.component.spec.ts b/aio/src/app/embedded/toc/toc.component.spec.ts index d9c2956bc6..778148328b 100644 --- a/aio/src/app/embedded/toc/toc.component.spec.ts +++ b/aio/src/app/embedded/toc/toc.component.spec.ts @@ -178,16 +178,10 @@ describe('TocComponent', () => { expect(tocComponent.isClosed).toEqual(true); }); - it('should scroll after clicking again', () => { + it('should not scroll after clicking again', () => { page.tocHeadingButton.nativeElement.click(); fixture.detectChanges(); - expect(scrollSpy).toHaveBeenCalled(); - }); - - it('should be "closed" after clicking tocMoreButton', () => { - page.tocMoreButton.nativeElement.click(); - fixture.detectChanges(); - expect(tocComponent.isClosed).toEqual(true); + expect(scrollSpy).not.toHaveBeenCalled(); }); }); @@ -216,17 +210,17 @@ describe('TocComponent', () => { expect(tocComponent.isClosed).toEqual(true); }); + it('should be "closed" after clicking tocHeadingButton', () => { + page.tocMoreButton.nativeElement.click(); + fixture.detectChanges(); + expect(tocComponent.isClosed).toEqual(true); + }); + it('should scroll after clicking again', () => { page.tocMoreButton.nativeElement.click(); fixture.detectChanges(); expect(scrollSpy).toHaveBeenCalled(); }); - - it('should be "closed" after clicking tocHeadingButton', () => { - page.tocHeadingButton.nativeElement.click(); - fixture.detectChanges(); - expect(tocComponent.isClosed).toEqual(true); - }); }); }); }); diff --git a/aio/src/app/embedded/toc/toc.component.ts b/aio/src/app/embedded/toc/toc.component.ts index a08b0825dc..700facc4b7 100644 --- a/aio/src/app/embedded/toc/toc.component.ts +++ b/aio/src/app/embedded/toc/toc.component.ts @@ -51,8 +51,8 @@ export class TocComponent implements OnInit, OnDestroy { this.onDestroy.next(); } - toggle() { + toggle(canScroll = true) { this.isClosed = !this.isClosed; - if (this.isClosed) { this.scrollService.scrollToTop(); } + if (canScroll && this.isClosed) { this.scrollService.scrollToTop(); } } } diff --git a/aio/src/app/shared/scroll.service.ts b/aio/src/app/shared/scroll.service.ts index 48dec9988f..05b216b643 100644 --- a/aio/src/app/shared/scroll.service.ts +++ b/aio/src/app/shared/scroll.service.ts @@ -1,4 +1,4 @@ -import { Injectable, Inject, InjectionToken } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { PlatformLocation } from '@angular/common'; import { DOCUMENT } from '@angular/platform-browser';