From a9096437fdb73e6b789ce3b3438aef3acd6946c6 Mon Sep 17 00:00:00 2001 From: Ward Bell Date: Thu, 2 Feb 2017 23:02:23 -0800 Subject: [PATCH] feat(aio): delete unused kruft --- angular.io/e2e/app.e2e-spec.ts | 11 ++-- angular.io/src/app/app.component.spec.ts | 57 ++++++++----------- angular.io/src/app/app.component.ts | 7 ++- angular.io/src/app/app.module.ts | 18 +++--- .../app/doc-viewer/doc-viewer.component.css | 0 .../app/doc-viewer/doc-viewer.component.html | 0 .../app/doc-viewer/doc-viewer.component.ts | 10 +--- .../src/app/docs-app/docs-app.component.css | 0 .../src/app/docs-app/docs-app.component.html | 3 - .../app/docs-app/docs-app.component.spec.ts | 28 --------- .../src/app/docs-app/docs-app.component.ts | 15 ----- .../src/app/docs-app/docs-app.module.ts | 19 ------- .../src/app/home-page/home-page.component.css | 0 .../app/home-page/home-page.component.html | 3 - .../app/home-page/home-page.component.spec.ts | 28 --------- .../src/app/home-page/home-page.component.ts | 15 ----- .../src/app/home-page/home-page.module.ts | 15 ----- .../{nav-engine.ts => nav-engine.service.ts} | 8 ++- .../{nav-link.ts => nav-link.directive.ts} | 2 +- .../src/app/page-manager.service.spec.ts | 16 ------ angular.io/src/app/page-manager.service.ts | 8 --- angular.io/src/index.html | 2 +- 22 files changed, 55 insertions(+), 210 deletions(-) delete mode 100644 angular.io/src/app/doc-viewer/doc-viewer.component.css delete mode 100644 angular.io/src/app/doc-viewer/doc-viewer.component.html delete mode 100644 angular.io/src/app/docs-app/docs-app.component.css delete mode 100644 angular.io/src/app/docs-app/docs-app.component.html delete mode 100644 angular.io/src/app/docs-app/docs-app.component.spec.ts delete mode 100644 angular.io/src/app/docs-app/docs-app.component.ts delete mode 100644 angular.io/src/app/docs-app/docs-app.module.ts delete mode 100644 angular.io/src/app/home-page/home-page.component.css delete mode 100644 angular.io/src/app/home-page/home-page.component.html delete mode 100644 angular.io/src/app/home-page/home-page.component.spec.ts delete mode 100644 angular.io/src/app/home-page/home-page.component.ts delete mode 100644 angular.io/src/app/home-page/home-page.module.ts rename angular.io/src/app/nav-engine/{nav-engine.ts => nav-engine.service.ts} (87%) rename angular.io/src/app/nav-engine/{nav-link.ts => nav-link.directive.ts} (87%) delete mode 100644 angular.io/src/app/page-manager.service.spec.ts delete mode 100644 angular.io/src/app/page-manager.service.ts diff --git a/angular.io/e2e/app.e2e-spec.ts b/angular.io/e2e/app.e2e-spec.ts index 1f33ba48d5..552fd75ce5 100644 --- a/angular.io/e2e/app.e2e-spec.ts +++ b/angular.io/e2e/app.e2e-spec.ts @@ -8,9 +8,12 @@ describe('site App', function() { }); it('should show features text after clicking "Features"', () => { - page.navigateTo(); - page.featureLink.click().then(() => { - expect(page.getDocViewerText()).toContain('Progressive web apps'); - }); + page.navigateTo() + .then(() => { + return page.featureLink.click(); + }) + .then(() => { + expect(page.getDocViewerText()).toContain('Progressive web apps'); + }); }); }); diff --git a/angular.io/src/app/app.component.spec.ts b/angular.io/src/app/app.component.spec.ts index a8d6a6f6a4..e83e1d3138 100644 --- a/angular.io/src/app/app.component.spec.ts +++ b/angular.io/src/app/app.component.spec.ts @@ -1,38 +1,31 @@ // /* tslint:disable:no-unused-variable */ -// import { TestBed, async } from '@angular/core/testing'; -// import { AppComponent } from './app.component'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { AppComponent } from './app.component'; +import { AppModule } from './app.module'; + +import { NavEngine } from './nav-engine/nav-engine.service'; describe('AppComponent', () => { - // beforeEach(() => { - // TestBed.configureTestingModule({ - // declarations: [ - // AppComponent - // ], - // }); - // TestBed.compileComponents(); - // }); - it('should work', () => { - expect(true).toBe(true); + let component: AppComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ AppModule ], + providers: [ + { provide: NavEngine, useValue: { currentDoc: undefined } } + ] + }); + TestBed.compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AppComponent); + component = fixture.componentInstance; + }); + + it('should create', () => { + expect(component).toBeDefined(); }); }); - -// it('should create the app', async(() => { -// const fixture = TestBed.createComponent(AppComponent); -// const app = fixture.debugElement.componentInstance; -// expect(app).toBeTruthy(); -// })); - -// it(`should have as title 'app works!'`, async(() => { -// const fixture = TestBed.createComponent(AppComponent); -// const app = fixture.debugElement.componentInstance; -// expect(app.title).toEqual('app works!'); -// })); - -// it('should render title in a h1 tag', async(() => { -// const fixture = TestBed.createComponent(AppComponent); -// fixture.detectChanges(); -// const compiled = fixture.debugElement.nativeElement; -// expect(compiled.querySelector('h1').textContent).toContain('app works!'); -// })); -// }); diff --git a/angular.io/src/app/app.component.ts b/angular.io/src/app/app.component.ts index 012d81275c..1fc3295212 100644 --- a/angular.io/src/app/app.component.ts +++ b/angular.io/src/app/app.component.ts @@ -1,11 +1,12 @@ import { Component } from '@angular/core'; -import { NavEngine } from './nav-engine/nav-engine'; + +import { NavEngine } from './nav-engine/nav-engine.service'; + @Component({ selector: 'aio-shell', templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + styleUrls: ['./app.component.scss'] }) export class AppComponent { - title = 'app works!'; constructor(public navEngine: NavEngine) {} } diff --git a/angular.io/src/app/app.module.ts b/angular.io/src/app/app.module.ts index bc4656432a..a2b5a87ce5 100644 --- a/angular.io/src/app/app.module.ts +++ b/angular.io/src/app/app.module.ts @@ -1,24 +1,24 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { AppComponent } from './app.component'; import { MdToolbarModule } from '@angular/material/toolbar'; import { MdButtonModule} from '@angular/material/button'; + +import { AppComponent } from './app.component'; import { DocViewerComponent } from './doc-viewer/doc-viewer.component'; -import { NavEngine } from './nav-engine/nav-engine'; -import { NavLinkDirective } from './nav-engine/nav-link'; +import { NavEngine } from './nav-engine/nav-engine.service'; +import { NavLinkDirective } from './nav-engine/nav-link.directive'; @NgModule({ - declarations: [ - AppComponent, - DocViewerComponent, - NavLinkDirective - ], imports: [ BrowserModule, MdToolbarModule.forRoot(), MdButtonModule.forRoot() ], + declarations: [ + AppComponent, + DocViewerComponent, + NavLinkDirective + ], providers: [NavEngine], bootstrap: [AppComponent] }) diff --git a/angular.io/src/app/doc-viewer/doc-viewer.component.css b/angular.io/src/app/doc-viewer/doc-viewer.component.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/angular.io/src/app/doc-viewer/doc-viewer.component.html b/angular.io/src/app/doc-viewer/doc-viewer.component.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/angular.io/src/app/doc-viewer/doc-viewer.component.ts b/angular.io/src/app/doc-viewer/doc-viewer.component.ts index 1270811ff2..8314cf77f1 100644 --- a/angular.io/src/app/doc-viewer/doc-viewer.component.ts +++ b/angular.io/src/app/doc-viewer/doc-viewer.component.ts @@ -1,13 +1,12 @@ -import { Component, OnInit, Input, ElementRef, ViewEncapsulation } from '@angular/core'; +import { Component, Input, ElementRef, ViewEncapsulation } from '@angular/core'; @Component({ selector: 'aio-doc-viewer', - templateUrl: './doc-viewer.component.html', - styleUrls: ['./doc-viewer.component.css'], + template: '' // TODO(robwormald): shadow DOM and emulated don't work here (?!) // encapsulation: ViewEncapsulation.Native }) -export class DocViewerComponent implements OnInit { +export class DocViewerComponent { @Input() set doc(currentDoc) { @@ -18,7 +17,4 @@ export class DocViewerComponent implements OnInit { constructor(private element: ElementRef) { } - ngOnInit() { - } - } diff --git a/angular.io/src/app/docs-app/docs-app.component.css b/angular.io/src/app/docs-app/docs-app.component.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/angular.io/src/app/docs-app/docs-app.component.html b/angular.io/src/app/docs-app/docs-app.component.html deleted file mode 100644 index bb31af74fe..0000000000 --- a/angular.io/src/app/docs-app/docs-app.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- docs-app works! -

diff --git a/angular.io/src/app/docs-app/docs-app.component.spec.ts b/angular.io/src/app/docs-app/docs-app.component.spec.ts deleted file mode 100644 index 3ddbe7fdd1..0000000000 --- a/angular.io/src/app/docs-app/docs-app.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -// /* tslint:disable:no-unused-variable */ -// import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -// import { By } from '@angular/platform-browser'; -// import { DebugElement } from '@angular/core'; - -// import { DocsAppComponent } from './docs-app.component'; - -// describe('DocsAppComponent', () => { -// let component: DocsAppComponent; -// let fixture: ComponentFixture; - -// beforeEach(async(() => { -// TestBed.configureTestingModule({ -// declarations: [ DocsAppComponent ] -// }) -// .compileComponents(); -// })); - -// beforeEach(() => { -// fixture = TestBed.createComponent(DocsAppComponent); -// component = fixture.componentInstance; -// fixture.detectChanges(); -// }); - -// it('should create', () => { -// expect(component).toBeTruthy(); -// }); -// }); diff --git a/angular.io/src/app/docs-app/docs-app.component.ts b/angular.io/src/app/docs-app/docs-app.component.ts deleted file mode 100644 index 659da60ab8..0000000000 --- a/angular.io/src/app/docs-app/docs-app.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'aio-ngio-docs', - templateUrl: './docs-app.component.html', - styleUrls: ['./docs-app.component.css'] -}) -export class DocsAppComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/angular.io/src/app/docs-app/docs-app.module.ts b/angular.io/src/app/docs-app/docs-app.module.ts deleted file mode 100644 index 18943d84ac..0000000000 --- a/angular.io/src/app/docs-app/docs-app.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { DocsAppComponent } from './docs-app.component'; -import { RouterModule } from '@angular/router'; - -@NgModule({ - imports: [ - CommonModule, - RouterModule.forChild([ - { path: '', pathMatch: 'full', component: DocsAppComponent} - ]) - ], - declarations: [ - DocsAppComponent - ] -}) -export class DocsAppModule { - -} diff --git a/angular.io/src/app/home-page/home-page.component.css b/angular.io/src/app/home-page/home-page.component.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/angular.io/src/app/home-page/home-page.component.html b/angular.io/src/app/home-page/home-page.component.html deleted file mode 100644 index 19d883fd10..0000000000 --- a/angular.io/src/app/home-page/home-page.component.html +++ /dev/null @@ -1,3 +0,0 @@ -

- home-page works! -

diff --git a/angular.io/src/app/home-page/home-page.component.spec.ts b/angular.io/src/app/home-page/home-page.component.spec.ts deleted file mode 100644 index 6b7d93046d..0000000000 --- a/angular.io/src/app/home-page/home-page.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -// /* tslint:disable:no-unused-variable */ -// import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -// import { By } from '@angular/platform-browser'; -// import { DebugElement } from '@angular/core'; - -// import { HomePageComponent } from './home-page.component'; - -// describe('HomePageComponent', () => { -// let component: HomePageComponent; -// let fixture: ComponentFixture; - -// beforeEach(async(() => { -// TestBed.configureTestingModule({ -// declarations: [ HomePageComponent ] -// }) -// .compileComponents(); -// })); - -// beforeEach(() => { -// fixture = TestBed.createComponent(HomePageComponent); -// component = fixture.componentInstance; -// fixture.detectChanges(); -// }); - -// it('should create', () => { -// expect(component).toBeTruthy(); -// }); -// }); diff --git a/angular.io/src/app/home-page/home-page.component.ts b/angular.io/src/app/home-page/home-page.component.ts deleted file mode 100644 index ad162c8e1c..0000000000 --- a/angular.io/src/app/home-page/home-page.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'aio-home-page', - templateUrl: './home-page.component.html', - styleUrls: ['./home-page.component.css'] -}) -export class HomePageComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/angular.io/src/app/home-page/home-page.module.ts b/angular.io/src/app/home-page/home-page.module.ts deleted file mode 100644 index 599860a0ad..0000000000 --- a/angular.io/src/app/home-page/home-page.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { HomePageComponent } from './home-page.component'; -import { RouterModule } from '@angular/router'; - -@NgModule({ - imports: [ - CommonModule, - RouterModule.forChild([ - { path: '', component: HomePageComponent } - ]) - ], - declarations: [HomePageComponent] -}) -export class HomePageModule { } diff --git a/angular.io/src/app/nav-engine/nav-engine.ts b/angular.io/src/app/nav-engine/nav-engine.service.ts similarity index 87% rename from angular.io/src/app/nav-engine/nav-engine.ts rename to angular.io/src/app/nav-engine/nav-engine.service.ts index 86ed275587..79493e694d 100644 --- a/angular.io/src/app/nav-engine/nav-engine.ts +++ b/angular.io/src/app/nav-engine/nav-engine.service.ts @@ -1,5 +1,7 @@ declare var fetch; +import { Injectable } from '@angular/core'; + // TODO(robwormald): figure out how to handle this properly... const siteMap = [ { 'title': 'Home', 'url': 'assets/documents/home.html', id: 'home'}, @@ -7,7 +9,7 @@ const siteMap = [ { 'title': 'News', 'url': 'assets/documents/news.html', id: 'news'} ]; - +@Injectable() export class NavEngine { currentDoc: any; constructor() {} @@ -15,7 +17,7 @@ export class NavEngine { console.log('navigating to', documentId); const doc = siteMap.find(d => d.id === documentId); if (doc) { - this._fetchDoc(doc.url) + this.fetchDoc(doc.url) .then(content => { console.log('fetched content', content); this.currentDoc = Object.assign({}, doc, {content}); @@ -23,7 +25,7 @@ export class NavEngine { } } - private _fetchDoc(url) { + private fetchDoc(url) { // TODO(robwormald): use Http proper once new API is done. return fetch(url).then(res => res.text()); } diff --git a/angular.io/src/app/nav-engine/nav-link.ts b/angular.io/src/app/nav-engine/nav-link.directive.ts similarity index 87% rename from angular.io/src/app/nav-engine/nav-link.ts rename to angular.io/src/app/nav-engine/nav-link.directive.ts index febef1948b..7d5af41361 100644 --- a/angular.io/src/app/nav-engine/nav-link.ts +++ b/angular.io/src/app/nav-engine/nav-link.directive.ts @@ -1,5 +1,5 @@ import { Directive, HostListener, Input } from '@angular/core'; -import { NavEngine } from './nav-engine'; +import { NavEngine } from './nav-engine.service'; @Directive({ selector: '[aioNavLink]' diff --git a/angular.io/src/app/page-manager.service.spec.ts b/angular.io/src/app/page-manager.service.spec.ts deleted file mode 100644 index 89b2a9ceab..0000000000 --- a/angular.io/src/app/page-manager.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* tslint:disable:no-unused-variable */ - -import { TestBed, async, inject } from '@angular/core/testing'; -import { PageManagerService } from './page-manager.service'; - -describe('PageManagerService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [PageManagerService] - }); - }); - - it('should ...', inject([PageManagerService], (service: PageManagerService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/angular.io/src/app/page-manager.service.ts b/angular.io/src/app/page-manager.service.ts deleted file mode 100644 index b038885a50..0000000000 --- a/angular.io/src/app/page-manager.service.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class PageManagerService { - - constructor() { } - -} diff --git a/angular.io/src/index.html b/angular.io/src/index.html index dab83942cb..1ebac24507 100644 --- a/angular.io/src/index.html +++ b/angular.io/src/index.html @@ -2,7 +2,7 @@ - (v42) One framework - Angular + Angular Docs v.2