Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 899bae6

Browse files
Foxandxsswardbell
authored andcommitted
docs(style-guide): add testing harness
1 parent 10b0cde commit 899bae6

File tree

58 files changed

+565
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+565
-13
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
*.js
2+
!systemjs.custom.js

public/docs/_examples/style-guide/ts/01-01/app/app.component.css

Whitespace-only changes.

public/docs/_examples/style-guide/ts/01-01/app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { HeroesComponent } from './heroes/heroes.component';
77
import { HeroService } from './heroes/shared/hero.service';
88

99
@Component({
10+
moduleId: module.id,
1011
selector: 'toh-app',
1112
template: `
1213
<toh-heroes></toh-heroes>
1314
`,
14-
styleUrls: ['app/app.component.css'],
15+
styleUrls: ['app.component.css'],
1516
directives: [HeroesComponent],
1617
providers: [HeroService]
1718
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Component } from '@angular/core';
2+
3+
import { HeroComponent } from './heroes/hero.component';
4+
import { UsersComponent } from './users/users.component';
5+
6+
@Component({
7+
selector: 'sg-app',
8+
template: `
9+
<toh-hero></toh-hero>
10+
<admin-users></admin-users>
11+
`,
12+
directives: [HeroComponent, UsersComponent]
13+
})
14+
export class AppComponent { }

public/docs/_examples/style-guide/ts/02-07/app/heroes/hero.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// #docplaster
12
// #docregion
23
import { Component } from '@angular/core';
34

45
// #docregion example
56
@Component({
7+
// #enddocregion example
8+
template: '<div>hero component</div>',
9+
// #docregion example
610
selector: 'toh-hero'
711
})
812
export class HeroComponent {}

public/docs/_examples/style-guide/ts/02-07/app/users/users.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// #docplaster
12
// #docregion
23
import { Component } from '@angular/core';
34

45
// #docregion example
56
@Component({
7+
// #enddocregion example
8+
template: '<div>users component</div>',
9+
// #docregion example
610
selector: 'admin-users'
711
})
812
export class UsersComponent {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Component } from '@angular/core';
2+
3+
import { ValidateDirective } from './shared/validate.directive';
4+
5+
@Component({
6+
selector: 'sg-app',
7+
template: '<input type="text" tohValidate>',
8+
directives: [ValidateDirective]
9+
})
10+
export class AppComponent { }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
import { ExceptionService } from './shared/exception.service';
4+
5+
@Component({
6+
selector: 'sg-app',
7+
template: '<div>The expected error is {{errorCode}}</div>',
8+
providers: [ExceptionService]
9+
})
10+
export class AppComponent implements OnInit {
11+
errorCode: number;
12+
13+
constructor(private exceptionService: ExceptionService) { }
14+
15+
ngOnInit() {
16+
this.errorCode = this.exceptionService.getException();
17+
}
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
// #docplaster
12
// #docregion
23
import { Injectable } from '@angular/core';
34

45
@Injectable()
56
// #docregion example
67
export class ExceptionService {
78
constructor() { }
9+
// #enddocregion example
10+
// testing harness
11+
getException() { return 42; }
12+
// #docregion example
813
}
914
// #enddocregion example
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component } from '@angular/core';
2+
3+
import { HEROES_URL, VILLAIN_URL } from './shared/data.service';
4+
5+
@Component({
6+
selector: 'sg-app',
7+
template: `
8+
<div>Heroes url: {{heroesUrl}}</div>
9+
<div>Villains url: {{villainsUrl}}</div>
10+
`,
11+
})
12+
export class AppComponent {
13+
heroesUrl = HEROES_URL;
14+
villainsUrl = VILLAIN_URL;
15+
}

0 commit comments

Comments
 (0)