diff --git a/aio/src/app/app.component.html b/aio/src/app/app.component.html index 4f37a04fe0e45..9aacb38ba0a62 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 344da3ca5a08f..079952d615f89 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 d9c2956bc60ee..778148328be7f 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,16 +210,16 @@ describe('TocComponent', () => { expect(tocComponent.isClosed).toEqual(true); }); - it('should scroll after clicking again', () => { + it('should be "closed" after clicking tocHeadingButton', () => { page.tocMoreButton.nativeElement.click(); fixture.detectChanges(); - expect(scrollSpy).toHaveBeenCalled(); + expect(tocComponent.isClosed).toEqual(true); }); - it('should be "closed" after clicking tocHeadingButton', () => { - page.tocHeadingButton.nativeElement.click(); + it('should scroll after clicking again', () => { + page.tocMoreButton.nativeElement.click(); fixture.detectChanges(); - expect(tocComponent.isClosed).toEqual(true); + expect(scrollSpy).toHaveBeenCalled(); }); }); }); diff --git a/aio/src/app/embedded/toc/toc.component.ts b/aio/src/app/embedded/toc/toc.component.ts index a08b0825dcc4c..700facc4b7098 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 48dec9988f014..05b216b64359a 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';