-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21b6689
commit 4a8cb85
Showing
14 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="list-group list-group-flush"> | ||
<a *ngFor="let player of players | async" | ||
[routerLink]="['/player', player.id]" | ||
class="list-group-item list-group-item-action"> | ||
{{ player.name }} | ||
</a> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { PlayerListComponent } from './player-list.component'; | ||
import { MockStore, provideMockStore } from '@ngrx/store/testing'; | ||
import { AppState } from '@app/app.state'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { Store } from '@ngrx/store'; | ||
import { allPlayers } from '../players.selectors'; | ||
|
||
describe('PlayerListComponent', () => { | ||
let component: PlayerListComponent; | ||
let fixture: ComponentFixture<PlayerListComponent>; | ||
let store: MockStore<AppState>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ PlayerListComponent ], | ||
imports: [ RouterTestingModule ], | ||
providers: [ | ||
provideMockStore(), | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
store = TestBed.get(Store); | ||
store.overrideSelector(allPlayers, []); | ||
|
||
fixture = TestBed.createComponent(PlayerListComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { Store } from '@ngrx/store'; | ||
import { AppState } from '@app/app.state'; | ||
import { allPlayers } from '../players.selectors'; | ||
import { Player } from '../models/player'; | ||
import { loadPlayers } from '../players.actions'; | ||
|
||
@Component({ | ||
selector: 'app-player-list', | ||
templateUrl: './player-list.component.html', | ||
styleUrls: ['./player-list.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class PlayerListComponent implements OnInit { | ||
|
||
players: Observable<Player[]> = this.store.select(allPlayers); | ||
|
||
constructor( | ||
private store: Store<AppState>, | ||
) { } | ||
|
||
ngOnInit() { | ||
this.store.dispatch(loadPlayers()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters