docs(style-guide): add more tests

closes #1532
This commit is contained in:
Foxandxss 2016-05-26 16:15:39 +02:00 committed by Ward Bell
parent c2c6096bec
commit f5614e858d
6 changed files with 16 additions and 4 deletions

View File

@ -58,6 +58,9 @@ describe('Style Guide', function () {
it('03-05', function () {
browser.get('#/03-05');
var div = element(by.tagName('sg-app > div'));
expect(div.getText()).toBe('Actual favorite: Windstorm');
var lis = element.all(by.tagName('sg-app > ul > li'));
expect(lis.get(0).getText()).toBe('Windstorm');
expect(lis.get(1).getText()).toBe('Bombasto');
@ -68,6 +71,9 @@ describe('Style Guide', function () {
it('03-06', function () {
browser.get('#/03-06');
var div = element(by.tagName('sg-app > div'));
expect(div.getText()).toBe('Actual favorite: Windstorm');
var lis = element.all(by.tagName('sg-app > ul > li'));
expect(lis.get(0).getText()).toBe('Windstorm');
expect(lis.get(1).getText()).toBe('Bombasto');

View File

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

View File

@ -11,11 +11,13 @@ import { Hero } from './+heroes/shared/hero.model';
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,3 +1,4 @@
<div>Actual favorite: {{favorite?.name}}</div>
<ul>
<li *ngFor="let hero of heroes">
{{hero.name}}

View File

@ -11,11 +11,13 @@ import { Hero } from './+heroes/shared/hero.model';
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,10 +1,10 @@
export class HeroData {
createDb() {
let heroes = [
{ id: '1', name: 'Windstorm' },
{ id: '2', name: 'Bombasto' },
{ id: '3', name: 'Magneta' },
{ id: '4', name: 'Tornado' }
{ id: 1, name: 'Windstorm' },
{ id: 2, name: 'Bombasto' },
{ id: 3, name: 'Magneta' },
{ id: 4, name: 'Tornado' }
];
return {heroes};
}