parent
c2c6096bec
commit
f5614e858d
@ -58,6 +58,9 @@ describe('Style Guide', function () {
|
|||||||
it('03-05', function () {
|
it('03-05', function () {
|
||||||
browser.get('#/03-05');
|
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'));
|
var lis = element.all(by.tagName('sg-app > ul > li'));
|
||||||
expect(lis.get(0).getText()).toBe('Windstorm');
|
expect(lis.get(0).getText()).toBe('Windstorm');
|
||||||
expect(lis.get(1).getText()).toBe('Bombasto');
|
expect(lis.get(1).getText()).toBe('Bombasto');
|
||||||
@ -68,6 +71,9 @@ describe('Style Guide', function () {
|
|||||||
it('03-06', function () {
|
it('03-06', function () {
|
||||||
browser.get('#/03-06');
|
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'));
|
var lis = element.all(by.tagName('sg-app > ul > li'));
|
||||||
expect(lis.get(0).getText()).toBe('Windstorm');
|
expect(lis.get(0).getText()).toBe('Windstorm');
|
||||||
expect(lis.get(1).getText()).toBe('Bombasto');
|
expect(lis.get(1).getText()).toBe('Bombasto');
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<div>Actual favorite: {{favorite?.name}}</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let hero of heroes">
|
<li *ngFor="let hero of heroes">
|
||||||
{{hero.name}}
|
{{hero.name}}
|
||||||
|
@ -11,11 +11,13 @@ import { Hero } from './+heroes/shared/hero.model';
|
|||||||
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
|
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
|
favorite: Hero;
|
||||||
heroes: Hero[];
|
heroes: Hero[];
|
||||||
|
|
||||||
constructor(private heroService: HeroService) { }
|
constructor(private heroService: HeroService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.heroService.getHero(1).subscribe(hero => this.favorite = hero);
|
||||||
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
|
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<div>Actual favorite: {{favorite?.name}}</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let hero of heroes">
|
<li *ngFor="let hero of heroes">
|
||||||
{{hero.name}}
|
{{hero.name}}
|
||||||
|
@ -11,11 +11,13 @@ import { Hero } from './+heroes/shared/hero.model';
|
|||||||
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
|
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
|
favorite: Hero;
|
||||||
heroes: Hero[];
|
heroes: Hero[];
|
||||||
|
|
||||||
constructor(private heroService: HeroService) { }
|
constructor(private heroService: HeroService) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.heroService.getHero(1).subscribe(hero => this.favorite = hero);
|
||||||
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
|
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
export class HeroData {
|
export class HeroData {
|
||||||
createDb() {
|
createDb() {
|
||||||
let heroes = [
|
let heroes = [
|
||||||
{ id: '1', name: 'Windstorm' },
|
{ id: 1, name: 'Windstorm' },
|
||||||
{ id: '2', name: 'Bombasto' },
|
{ id: 2, name: 'Bombasto' },
|
||||||
{ id: '3', name: 'Magneta' },
|
{ id: 3, name: 'Magneta' },
|
||||||
{ id: '4', name: 'Tornado' }
|
{ id: 4, name: 'Tornado' }
|
||||||
];
|
];
|
||||||
return {heroes};
|
return {heroes};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user