From 2f18e8565e16a6727959ef12445bdd1a17aea6d4 Mon Sep 17 00:00:00 2001 From: Sonu Kapoor Date: Sat, 15 Feb 2020 23:06:07 -0500 Subject: [PATCH] style(docs-infra): properly format files (#35318) PR Close #35318 --- aio/src/app/app.component.spec.ts | 35 +++++++++----------- aio/src/app/app.component.ts | 55 +++++++++++++++---------------- 2 files changed, 42 insertions(+), 48 deletions(-) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index de93fe47c0..35328c279f 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -1,35 +1,32 @@ -import { NO_ERRORS_SCHEMA, DebugElement } from '@angular/core'; -import { inject, ComponentFixture, TestBed, fakeAsync, flushMicrotasks, tick } from '@angular/core/testing'; -import { Title } from '@angular/platform-browser'; import { APP_BASE_HREF } from '@angular/common'; import { HttpClient } from '@angular/common/http'; +import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; +import { ComponentFixture, fakeAsync, flushMicrotasks, inject, TestBed, tick } from '@angular/core/testing'; import { MatProgressBar } from '@angular/material/progress-bar'; import { MatSidenav } from '@angular/material/sidenav'; -import { By } from '@angular/platform-browser'; - -import { Subject, of, timer } from 'rxjs'; -import { first, mapTo } from 'rxjs/operators'; - -import { AppComponent } from './app.component'; -import { AppModule } from './app.module'; -import { CurrentNodes } from 'app/navigation/navigation.model'; +import { By, Title } from '@angular/platform-browser'; +import { ElementsLoader } from 'app/custom-elements/elements-loader'; import { DocumentService } from 'app/documents/document.service'; import { DocViewerComponent } from 'app/layout/doc-viewer/doc-viewer.component'; +import { CurrentNodes } from 'app/navigation/navigation.model'; +import { NavigationNode, NavigationService } from 'app/navigation/navigation.service'; +import { SearchBoxComponent } from 'app/search/search-box/search-box.component'; +import { SearchService } from 'app/search/search.service'; import { Deployment } from 'app/shared/deployment.service'; -import { ElementsLoader } from 'app/custom-elements/elements-loader'; import { GaService } from 'app/shared/ga.service'; import { LocationService } from 'app/shared/location.service'; import { Logger } from 'app/shared/logger.service'; +import { ScrollService } from 'app/shared/scroll.service'; +import { SearchResultsComponent } from 'app/shared/search-results/search-results.component'; +import { SelectComponent } from 'app/shared/select/select.component'; +import { TocItem, TocService } from 'app/shared/toc.service'; +import { of, Subject, timer } from 'rxjs'; +import { first, mapTo } from 'rxjs/operators'; import { MockLocationService } from 'testing/location.service'; import { MockLogger } from 'testing/logger.service'; import { MockSearchService } from 'testing/search.service'; -import { NavigationNode, NavigationService } from 'app/navigation/navigation.service'; -import { ScrollService } from 'app/shared/scroll.service'; -import { SearchBoxComponent } from 'app/search/search-box/search-box.component'; -import { SearchResultsComponent } from 'app/shared/search-results/search-results.component'; -import { SearchService } from 'app/search/search.service'; -import { SelectComponent } from 'app/shared/select/select.component'; -import { TocItem, TocService } from 'app/shared/toc.service'; +import { AppComponent } from './app.component'; +import { AppModule } from './app.module'; const sideBySideBreakPoint = 992; const hideToCBreakPoint = 800; diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index e0df8fcce1..b5fa56c11d 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -1,18 +1,15 @@ -import { Component, ElementRef, HostBinding, HostListener, OnInit, - QueryList, ViewChild, ViewChildren } from '@angular/core'; +import { Component, ElementRef, HostBinding, HostListener, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; import { MatSidenav } from '@angular/material/sidenav'; - -import { CurrentNodes, NavigationService, NavigationNode, VersionInfo } from 'app/navigation/navigation.service'; -import { DocumentService, DocumentContents } from 'app/documents/document.service'; +import { DocumentContents, DocumentService } from 'app/documents/document.service'; +import { NotificationComponent } from 'app/layout/notification/notification.component'; +import { CurrentNodes, NavigationNode, NavigationService, VersionInfo } from 'app/navigation/navigation.service'; +import { SearchResults } from 'app/search/interfaces'; +import { SearchBoxComponent } from 'app/search/search-box/search-box.component'; +import { SearchService } from 'app/search/search.service'; import { Deployment } from 'app/shared/deployment.service'; import { LocationService } from 'app/shared/location.service'; -import { NotificationComponent } from 'app/layout/notification/notification.component'; import { ScrollService } from 'app/shared/scroll.service'; -import { SearchBoxComponent } from 'app/search/search-box/search-box.component'; -import { SearchResults } from 'app/search/interfaces'; -import { SearchService } from 'app/search/search.service'; import { TocService } from 'app/shared/toc.service'; - import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; import { first, map } from 'rxjs/operators'; @@ -150,27 +147,27 @@ export class AppComponent implements OnInit { this.navigationService.versionInfo, 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' }, - { title: 'stable', url: 'https://angular.io' }, - ]; - if (this.deployment.mode === 'archive') { - computedVersions.push({ title: `v${versionInfo.major}` }); - } - this.docVersions = [...computedVersions, ...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' }, + { title: 'stable', url: 'https://angular.io' }, + ]; + if (this.deployment.mode === 'archive') { + computedVersions.push({ title: `v${versionInfo.major}` }); + } + this.docVersions = [...computedVersions, ...versions]; - // Find the current version - eithers title matches the current deployment mode - // or its title matches the major version of the current version info - this.currentDocVersion = this.docVersions.find(version => - version.title === this.deployment.mode || version.title === `v${versionInfo.major}`)!; - this.currentDocVersion.title += ` (v${versionInfo.raw})`; - }); + // Find the current version - eithers title matches the current deployment mode + // or its title matches the major version of the current version info + this.currentDocVersion = this.docVersions.find(version => + version.title === this.deployment.mode || version.title === `v${versionInfo.major}`)!; + this.currentDocVersion.title += ` (v${versionInfo.raw})`; + }); this.navigationService.navigationViews.subscribe(views => { - this.footerNodes = views['Footer'] || []; + this.footerNodes = views['Footer'] || []; this.sideNavNodes = views['SideNav'] || []; - this.topMenuNodes = views['TopBar'] || []; + this.topMenuNodes = views['TopBar'] || []; this.topMenuNarrowNodes = views['TopBarNarrow'] || this.topMenuNodes; }); @@ -267,7 +264,7 @@ export class AppComponent implements OnInit { } // Deal with anchor clicks; climb DOM tree until anchor found (or null) - let target: HTMLElement|null = eventTarget; + let target: HTMLElement | null = eventTarget; while (target && !(target instanceof HTMLAnchorElement)) { target = target.parentElement; } @@ -410,7 +407,7 @@ export class AppComponent implements OnInit { if (key === '/' || keyCode === 191) { this.focusSearchBox(); } - if (key === 'Escape' || keyCode === 27 ) { + if (key === 'Escape' || keyCode === 27) { // escape key if (this.showSearchResults) { this.hideSearchResults();