diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index b9342e147f..a4caa5d5e7 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -144,10 +144,10 @@ export class AppComponent implements OnInit { }); // Compute the version picker list from the current version and the versions in the navigation map - combineLatest( + combineLatest([ this.navigationService.versionInfo, - this.navigationService.navigationViews.pipe(map(views => views['docVersions']))) - .subscribe(([versionInfo, versions]) => { + this.navigationService.navigationViews.pipe(map(views => views['docVersions'])), + ]).subscribe(([versionInfo, versions]) => { // TODO(pbd): consider whether we can lookup the stable and next versions from the internet const computedVersions: NavigationNode[] = [ { title: 'next', url: 'https://next.angular.io' }, @@ -175,7 +175,7 @@ export class AppComponent implements OnInit { this.navigationService.versionInfo.subscribe(vi => this.versionInfo = vi); const hasNonEmptyToc = this.tocService.tocList.pipe(map(tocList => tocList.length > 0)); - combineLatest(hasNonEmptyToc, this.showFloatingToc) + combineLatest([hasNonEmptyToc, this.showFloatingToc]) .subscribe(([hasToc, showFloatingToc]) => this.hasFloatingToc = hasToc && showFloatingToc); // Generally, we want to delay updating the shell (e.g. host classes, sidenav state) for the new @@ -183,10 +183,10 @@ export class AppComponent implements OnInit { // the new document applied prematurely). // For the first document, though, (when we know there is no previous document), we want to // ensure the styles are applied as soon as possible to avoid flicker. - combineLatest( + combineLatest([ this.documentService.currentDocument, // ...needed to determine host classes - this.navigationService.currentNodes) // ...needed to determine `sidenav` state - .pipe(first()) + this.navigationService.currentNodes, // ...needed to determine `sidenav` state + ]).pipe(first()) .subscribe(() => this.updateShell()); } diff --git a/aio/src/app/custom-elements/announcement-bar/announcement-bar.component.spec.ts b/aio/src/app/custom-elements/announcement-bar/announcement-bar.component.spec.ts index 23069f019b..99df0564ee 100644 --- a/aio/src/app/custom-elements/announcement-bar/announcement-bar.component.spec.ts +++ b/aio/src/app/custom-elements/announcement-bar/announcement-bar.component.spec.ts @@ -25,8 +25,8 @@ describe('AnnouncementBarComponent', () => { providers: [{ provide: Logger, useClass: MockLogger }] }); - httpMock = injector.get(HttpTestingController); - mockLogger = injector.get(Logger); + httpMock = injector.inject(HttpTestingController); + mockLogger = injector.inject(Logger) as any; fixture = TestBed.createComponent(AnnouncementBarComponent); component = fixture.componentInstance; element = fixture.nativeElement; diff --git a/aio/src/app/custom-elements/api/api-list.component.ts b/aio/src/app/custom-elements/api/api-list.component.ts index 4ef0d578ed..2adf78aec9 100644 --- a/aio/src/app/custom-elements/api/api-list.component.ts +++ b/aio/src/app/custom-elements/api/api-list.component.ts @@ -69,10 +69,10 @@ export class ApiListComponent implements OnInit { ngOnInit() { this.filteredSections = - combineLatest( + combineLatest([ this.apiService.sections, - this.criteriaSubject - ).pipe( + this.criteriaSubject, + ]).pipe( map( results => ({ sections: results[0], criteria: results[1]})), map( results => ( results.sections diff --git a/aio/src/app/custom-elements/api/api.service.spec.ts b/aio/src/app/custom-elements/api/api.service.spec.ts index 58d287acbe..9f3c482d98 100644 --- a/aio/src/app/custom-elements/api/api.service.spec.ts +++ b/aio/src/app/custom-elements/api/api.service.spec.ts @@ -35,11 +35,7 @@ describe('ApiService', () => { it('subscribers should be completed/unsubscribed when service destroyed', () => { let completed = false; - service.sections.subscribe( - undefined, - undefined, - () => completed = true - ); + service.sections.subscribe({complete: () => completed = true}); service.ngOnDestroy(); expect(completed).toBe(true); diff --git a/aio/src/app/custom-elements/contributor/contributor.service.spec.ts b/aio/src/app/custom-elements/contributor/contributor.service.spec.ts index c5d2599e37..93877ea972 100644 --- a/aio/src/app/custom-elements/contributor/contributor.service.spec.ts +++ b/aio/src/app/custom-elements/contributor/contributor.service.spec.ts @@ -43,7 +43,7 @@ describe('ContributorService', () => { it('contributors observable should complete', () => { let completed = false; - contribService.contributors.subscribe(undefined, undefined, () => completed = true); + contribService.contributors.subscribe({complete: () => completed = true}); expect(completed).toBe(true, 'observable completed'); }); diff --git a/aio/src/app/custom-elements/elements-loader.spec.ts b/aio/src/app/custom-elements/elements-loader.spec.ts index ba4584d18b..48c188df1b 100644 --- a/aio/src/app/custom-elements/elements-loader.spec.ts +++ b/aio/src/app/custom-elements/elements-loader.spec.ts @@ -35,8 +35,8 @@ describe('ElementsLoader', () => { ] }); - elementsLoader = injector.get(ElementsLoader); - compiler = injector.get(Compiler); + elementsLoader = injector.inject(ElementsLoader); + compiler = injector.inject(Compiler); }); describe('loadContainedCustomElements()', () => { diff --git a/aio/src/app/custom-elements/lazy-custom-element.component.spec.ts b/aio/src/app/custom-elements/lazy-custom-element.component.spec.ts index 5bb0eeefa5..d44d1cb64a 100644 --- a/aio/src/app/custom-elements/lazy-custom-element.component.spec.ts +++ b/aio/src/app/custom-elements/lazy-custom-element.component.spec.ts @@ -23,7 +23,7 @@ describe('LazyCustomElementComponent', () => { ], }); - mockLogger = injector.get(Logger); + mockLogger = injector.inject(Logger) as any; fixture = TestBed.createComponent(LazyCustomElementComponent); }); diff --git a/aio/src/app/custom-elements/resource/resource.service.spec.ts b/aio/src/app/custom-elements/resource/resource.service.spec.ts index e376268df6..5517dc60e7 100644 --- a/aio/src/app/custom-elements/resource/resource.service.spec.ts +++ b/aio/src/app/custom-elements/resource/resource.service.spec.ts @@ -43,7 +43,7 @@ describe('ResourceService', () => { it('categories observable should complete', () => { let completed = false; - resourceService.categories.subscribe(undefined, undefined, () => completed = true); + resourceService.categories.subscribe({complete: () => completed = true}); expect(completed).toBe(true, 'observable completed'); }); diff --git a/aio/src/app/custom-elements/toc/toc.component.spec.ts b/aio/src/app/custom-elements/toc/toc.component.spec.ts index 57e831be4a..3dc17586cb 100644 --- a/aio/src/app/custom-elements/toc/toc.component.spec.ts +++ b/aio/src/app/custom-elements/toc/toc.component.spec.ts @@ -1,7 +1,7 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { asapScheduler as asap, BehaviorSubject } from 'rxjs'; +import { asapScheduler, BehaviorSubject } from 'rxjs'; import { ScrollService } from 'app/shared/scroll.service'; import { TocItem, TocService } from 'app/shared/toc.service'; @@ -465,10 +465,11 @@ class TestScrollService { class TestTocService { tocList = new BehaviorSubject(getTestTocList()); activeItemIndex = new BehaviorSubject(null); + setActiveIndex(index: number|null) { this.activeItemIndex.next(index); - if (asap.scheduled !== undefined) { - asap.flush(); + if (asapScheduler.actions.length > 0) { + asapScheduler.flush(); } } } diff --git a/aio/src/app/custom-elements/toc/toc.component.ts b/aio/src/app/custom-elements/toc/toc.component.ts index 0cbab775b6..ceb6ce821a 100644 --- a/aio/src/app/custom-elements/toc/toc.component.ts +++ b/aio/src/app/custom-elements/toc/toc.component.ts @@ -52,7 +52,10 @@ export class TocComponent implements OnInit, AfterViewInit, OnDestroy { // We use the `asap` scheduler because updates to `activeItemIndex` are triggered by DOM changes, // which, in turn, are caused by the rendering that happened due to a ChangeDetection. // Without asap, we would be updating the model while still in a ChangeDetection handler, which is disallowed by Angular. - combineLatest(this.tocService.activeItemIndex.pipe(subscribeOn(asapScheduler)), this.items.changes.pipe(startWith(this.items))) + combineLatest([ + this.tocService.activeItemIndex.pipe(subscribeOn(asapScheduler)), + this.items.changes.pipe(startWith(this.items)), + ]) .pipe(takeUntil(this.onDestroy)) .subscribe(([index, items]) => { this.activeIndex = index; diff --git a/aio/src/app/documents/document.service.spec.ts b/aio/src/app/documents/document.service.spec.ts index 56306780df..756651c1ce 100644 --- a/aio/src/app/documents/document.service.spec.ts +++ b/aio/src/app/documents/document.service.spec.ts @@ -30,11 +30,11 @@ describe('DocumentService', () => { function getServices(initialUrl: string = '') { const injector = createInjector(initialUrl); - httpMock = injector.get(HttpTestingController) as HttpTestingController; + httpMock = injector.inject(HttpTestingController); return { - locationService: injector.get(LocationService) as MockLocationService, - docService: injector.get(DocumentService) as DocumentService, - logger: injector.get(Logger) as MockLogger + locationService: injector.inject(LocationService) as any as MockLocationService, + docService: injector.inject(DocumentService) as any as DocumentService, + logger: injector.inject(Logger) as any as MockLogger, }; } diff --git a/aio/src/app/navigation/navigation.service.spec.ts b/aio/src/app/navigation/navigation.service.spec.ts index 541ec5bd14..028b357979 100644 --- a/aio/src/app/navigation/navigation.service.spec.ts +++ b/aio/src/app/navigation/navigation.service.spec.ts @@ -47,7 +47,7 @@ describe('NavigationService', () => { it('navigationViews observable should complete', () => { let completed = false; - navService.navigationViews.subscribe(undefined, undefined, () => completed = true); + navService.navigationViews.subscribe({complete: () => completed = true}); httpMock.expectOne({method: 'get', url: navigationPath}).flush({}); expect(completed).toBe(true, 'observable completed'); diff --git a/aio/src/app/navigation/navigation.service.ts b/aio/src/app/navigation/navigation.service.ts index 87bd602763..06162678ff 100644 --- a/aio/src/app/navigation/navigation.service.ts +++ b/aio/src/app/navigation/navigation.service.ts @@ -90,11 +90,12 @@ export class NavigationService { * See above for discussion of using `connect`. */ private getCurrentNodes(navigationViews: Observable): Observable { - const currentNodes = combineLatest( + const currentNodes = combineLatest([ navigationViews.pipe( map(views => this.computeUrlToNavNodesMap(views))), - this.location.currentPath, - ).pipe( + this.location.currentPath, + ]) + .pipe( map((result) => ({navMap: result[0] , url: result[1]})), map((result) => { const matchSpecialUrls = /^api/.exec(result.url); diff --git a/aio/src/app/shared/reporting-error-handler.spec.ts b/aio/src/app/shared/reporting-error-handler.spec.ts index e8aef4440b..a7389824d4 100644 --- a/aio/src/app/shared/reporting-error-handler.spec.ts +++ b/aio/src/app/shared/reporting-error-handler.spec.ts @@ -22,7 +22,7 @@ describe('ReportingErrorHandler service', () => { }); it('should be registered on the AppModule', () => { - handler = TestBed.configureTestingModule({ imports: [AppModule] }).get(ErrorHandler); + handler = TestBed.configureTestingModule({ imports: [AppModule] }).inject(ErrorHandler) as any; expect(handler).toEqual(jasmine.any(ReportingErrorHandler)); });