refactor(docs-infra): remove unused styleguide examples (#38143)

The `03-*` code style rule have been removed from the style guide in
be0bc799f3.

This commit removes the corresponding files and related unused code from
the`styleguide` example project.

PR Close #38143
This commit is contained in:
George Kalpakas 2020-07-30 13:03:07 +03:00 committed by Alex Rickabaugh
parent e8896b9de3
commit 00b7186cb2
42 changed files with 0 additions and 510 deletions

View File

@ -29,50 +29,6 @@ describe('Style Guide', function () {
expect(input.isPresent()).toBe(true);
});
it('03-01', function () {
browser.get('#/03-01');
let div = element(by.tagName('sg-app > div'));
expect(div.getText()).toBe('The expected error is 42');
});
it('03-02', function () {
browser.get('#/03-02');
let divs = element.all(by.tagName('sg-app > div'));
expect(divs.get(0).getText()).toBe('Heroes url: api/heroes');
expect(divs.get(1).getText()).toBe('Villains url: api/villains');
});
it('03-03', function () {
browser.get('#/03-03');
let div = element(by.tagName('sg-app > div'));
expect(div.getText()).toBe('Our hero is RubberMan and He is so elastic');
});
it('03-04', function () {
browser.get('#/03-04');
let buttons = element.all(by.tagName('sg-app > button'));
expect(buttons.get(0).getText()).toBe('Show toast');
expect(buttons.get(1).getText()).toBe('Hide toast');
});
// temporarily disabled because of a weird issue when used with rxjs v6 with rxjs-compat
xit('03-06', function () {
browser.get('#/03-06');
let div = element(by.tagName('sg-app > div'));
expect(div.getText()).toBe('Actual favorite: Windstorm');
let lis = element.all(by.tagName('sg-app > ul > li'));
expect(lis.get(0).getText()).toBe('Windstorm');
expect(lis.get(1).getText()).toBe('Bombasto');
expect(lis.get(2).getText()).toBe('Magneta');
expect(lis.get(3).getText()).toBe('Tornado');
});
it('04-10', function () {
browser.get('#/04-10');

View File

@ -1,18 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ExceptionService } from './core';
@Component({
selector: 'sg-app',
template: '<div>The expected error is {{errorCode}}</div>',
providers: [ExceptionService]
})
export class AppComponent implements OnInit {
errorCode: number;
constructor(private exceptionService: ExceptionService) { }
ngOnInit() {
this.errorCode = this.exceptionService.getException();
}
}

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@NgModule({
imports: [
RouterModule.forChild([{ path: '03-01', component: AppComponent }])
],
declarations: [
AppComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -1,11 +0,0 @@
// #docregion
import { Injectable } from '@angular/core';
@Injectable()
// #docregion example
/* avoid */
export class exceptionService {
constructor() { }
}
// #enddocregion example

View File

@ -1,14 +0,0 @@
// #docplaster
// #docregion
import { Injectable } from '@angular/core';
@Injectable()
// #docregion example
export class ExceptionService {
constructor() { }
// #enddocregion example
// testing harness
getException() { return 42; }
// #docregion example
}
// #enddocregion example

View File

@ -1 +0,0 @@
export * from './exception.service';

View File

@ -1,2 +0,0 @@
export * from './core';
export * from './app.component';

View File

@ -1,19 +0,0 @@
import { Component } from '@angular/core';
import { heroesUrl, mockHeroes, VILLAINS_URL } from './core';
@Component({
selector: 'sg-app',
template: `
<div>Heroes url: {{heroesUrl}}</div>
<div>Villains url: {{villainsUrl}}</div>
<h4>Mock Heroes</h4>
<div *ngFor="let hero of heroes">{{hero}}</div>
`
})
export class AppComponent {
heroes = mockHeroes; // prefer
heroesUrl = heroesUrl; // prefer
villainsUrl = VILLAINS_URL; // tolerate
}

View File

@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
RouterModule.forChild([{ path: '03-02', component: AppComponent }])
],
declarations: [
AppComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -1,4 +0,0 @@
// #docregion
export const mockHeroes = ['Sam', 'Jill']; // prefer
export const heroesUrl = 'api/heroes'; // prefer
export const VILLAINS_URL = 'api/villains'; // tolerate

View File

@ -1 +0,0 @@
export * from './data.service';

View File

@ -1,2 +0,0 @@
export * from './core';
export * from './app.component';

View File

@ -1,18 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { Hero, HeroCollectorService } from './core';
@Component({
selector: 'sg-app',
template: '<div>Our hero is {{hero.name}} and {{hero.power}}</div>',
providers: [HeroCollectorService]
})
export class AppComponent implements OnInit {
hero: Hero;
constructor(private heroCollectorService: HeroCollectorService) { }
ngOnInit() {
this.hero = this.heroCollectorService.getHero();
}
}

View File

@ -1,15 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@NgModule({
imports: [
RouterModule.forChild([{ path: '03-03', component: AppComponent }])
],
declarations: [
AppComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -1,15 +0,0 @@
// #docregion
// #docregion example
/* avoid */
import { Injectable } from '@angular/core';
import { IHero } from './hero.model.avoid';
@Injectable()
export class HeroCollectorService {
hero: IHero;
constructor() { }
}
// #enddocregion example

View File

@ -1,25 +0,0 @@
// #docplaster
// #docregion
// #docregion example
import { Injectable } from '@angular/core';
import { Hero } from './hero.model';
@Injectable()
export class HeroCollectorService {
hero: Hero;
constructor() { }
// #enddocregion example
// testing harness
getHero() {
this.hero = {
name: 'RubberMan',
power: 'He is so elastic'
};
return this.hero;
}
// #docregion example
}
// #enddocregion example

View File

@ -1,14 +0,0 @@
// #docregion
// #docregion example
/* avoid */
export interface IHero {
name: string;
power: string;
}
export class Hero implements IHero {
name: string;
power: string;
}
// #enddocregion example

View File

@ -1,7 +0,0 @@
// #docregion
// #docregion example
export interface Hero {
name: string;
power: string;
}
// #enddocregion example

View File

@ -1,2 +0,0 @@
export * from './hero-collector.service';
export * from './hero.model';

View File

@ -1,2 +0,0 @@
export * from './core';
export * from './app.component';

View File

@ -1,27 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ToastService } from './core';
@Component({
selector: 'sg-app',
template: `
<button (click)="show()">Show toast</button>
<button (click)="hide()">Hide toast</button>
`,
providers: [ToastService]
})
export class AppComponent implements OnInit {
constructor(private toastService: ToastService) { }
hide() {
this.toastService.hide();
}
show() {
this.toastService.show();
}
ngOnInit() {
this.toastService.activate('Hello Style Guide!');
}
}

View File

@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
RouterModule.forChild([{ path: '03-04', component: AppComponent }])
],
declarations: [
AppComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -1 +0,0 @@
export * from './toast.service';

View File

@ -1,27 +0,0 @@
// #docregion
// #docregion example
/* avoid */
import { Injectable } from '@angular/core';
@Injectable()
export class ToastService {
message: string;
private _toastCount: number;
hide() {
this._toastCount--;
this._log();
}
show() {
this._toastCount++;
this._log();
}
private _log() {
console.log(this.message);
}
}
// #enddocregion example

View File

@ -1,32 +0,0 @@
// #docplaster
// #docregion
// #docregion example
import { Injectable } from '@angular/core';
@Injectable()
export class ToastService {
message: string;
private toastCount: number;
hide() {
this.toastCount--;
this.log();
}
show() {
this.toastCount++;
this.log();
}
private log() {
console.log(this.message);
}
// #enddocregion example
// testing harness
activate(message: string) {
this.message = message;
}
// #docregion example
}
// #enddocregion example

View File

@ -1,2 +0,0 @@
export * from './core';
export * from './app.component';

View File

@ -1,6 +0,0 @@
<div>Actual favorite: {{favorite?.name}}</div>
<ul>
<li *ngFor="let hero of heroes">
{{hero.name}}
</li>
</ul>

View File

@ -1,21 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { Hero, HeroService } from './heroes';
import { ExceptionService, SpinnerService, ToastService } from './core';
@Component({
selector: 'sg-app',
templateUrl: './app.component.html',
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
})
export class AppComponent implements OnInit {
favorite: Hero;
heroes: Hero[];
constructor(private heroService: HeroService) { }
ngOnInit() {
this.heroService.getHero(1).subscribe(hero => this.favorite = hero);
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
}
}

View File

@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
RouterModule.forChild([{ path: '03-06', component: AppComponent }])
],
declarations: [
AppComponent
],
exports: [ AppComponent ]
})
export class AppModule {}

View File

@ -1,4 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable()
export class ExceptionService { }

View File

@ -1,6 +0,0 @@
// #docregion
// #docregion example
export * from './exception.service';
export * from './spinner';
export * from './toast';
// #enddocregion example

View File

@ -1,2 +0,0 @@
// #docregion
export * from './spinner.service';

View File

@ -1,12 +0,0 @@
import { Injectable } from '@angular/core';
export interface ISpinnerState { }
@Injectable()
export class SpinnerService {
spinnerState: any;
show() { }
hide() { }
}

View File

@ -1,2 +0,0 @@
// #docregion
export * from './toast.service';

View File

@ -1,6 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable()
export class ToastService {
activate: (message?: string, title?: string) => void;
}

View File

@ -1 +0,0 @@
export * from './shared';

View File

@ -1,7 +0,0 @@
// #docregion
// #docregion example
export interface Hero {
name: string;
power: string;
}
// #enddocregion example

View File

@ -1,29 +0,0 @@
// #docregion
// #docregion example
/* avoid */
import { ExceptionService, SpinnerService, ToastService } from '../../core';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Hero } from './hero.model';
// #enddocregion example
@Injectable()
export class HeroService {
constructor(
private exceptionService: ExceptionService,
private spinnerService: SpinnerService,
private toastService: ToastService,
private http: HttpClient
) { }
getHero(id: number) {
return this.http.get<Hero>(`api/heroes/${id}`);
}
getHeroes() {
return this.http.get<Hero[]>(`api/heroes`);
}
}

View File

@ -1,30 +0,0 @@
// #docregion
// #docregion example
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ExceptionService, SpinnerService, ToastService } from '../../core';
import { Hero } from './hero.model';
// #enddocregion example
@Injectable()
export class HeroService {
cachedHeroes: Hero[];
constructor(
private exceptionService: ExceptionService,
private spinnerService: SpinnerService,
private toastService: ToastService,
private http: HttpClient
) { }
getHero(id: number) {
return this.http.get<Hero>(`api/heroes/${id}`);
}
getHeroes() {
return this.http.get<Hero[]>(`api/heroes`);
}
}

View File

@ -1,2 +0,0 @@
export * from './hero.model';
export * from './hero.service';

View File

@ -1,3 +0,0 @@
export * from './heroes';
export * from './core';
export * from './app.component';

View File

@ -16,11 +16,6 @@ import * as s0101 from '../01-01/app/app.module';
import * as s0205 from '../02-05/app/app.module';
import * as s0207 from '../02-07/app/app.module';
import * as s0208 from '../02-08/app/app.module';
import * as s0301 from '../03-01/app/app.module';
import * as s0302 from '../03-02/app/app.module';
import * as s0303 from '../03-03/app/app.module';
import * as s0304 from '../03-04/app/app.module';
import * as s0306 from '../03-06/app/app.module';
import * as s0408 from '../04-08/app/app.module';
import * as s0410 from '../04-10/app/app.module';
import * as s0411 from '../04-11/app/app.module';
@ -51,11 +46,6 @@ import * as s0901 from '../09-01/app/app.module';
s0205.AppModule,
s0207.AppModule,
s0208.AppModule,
s0301.AppModule,
s0302.AppModule,
s0303.AppModule,
s0304.AppModule,
s0306.AppModule,
s0408.AppModule,
s0410.AppModule,
s0411.AppModule,