generated from bisco/codex-bootstrap
fix: make scouting filters immediate and loading state precise
This commit is contained in:
@@ -89,6 +89,37 @@ describe('AppComponent', () => {
|
||||
assert.equal(calls, 1);
|
||||
});
|
||||
|
||||
it('applies quick filters immediately and can clear them with all controls', () => {
|
||||
const requestedPositions: string[] = [];
|
||||
const api = {
|
||||
searchPlayers: (filters: { position: string; league: string }) => {
|
||||
requestedPositions.push(`${filters.position}:${filters.league}`);
|
||||
return of({ count: 0, results: [] });
|
||||
},
|
||||
} as unknown as PlayerApiService;
|
||||
const component = new AppComponent(api);
|
||||
|
||||
component.setPosition('PG');
|
||||
component.setLeague('LBA');
|
||||
component.setPosition('');
|
||||
component.setLeague('');
|
||||
|
||||
assert.deepEqual(requestedPositions, ['PG:', 'PG:LBA', ':LBA', ':']);
|
||||
});
|
||||
|
||||
it('shows the loading placeholder only before results exist', () => {
|
||||
const api = {
|
||||
searchPlayers: () => of({ count: samplePlayers.length, results: samplePlayers }),
|
||||
} as unknown as PlayerApiService;
|
||||
const component = new AppComponent(api);
|
||||
|
||||
component.loading = true;
|
||||
assert.equal(component.showLoadingPlaceholder, true);
|
||||
|
||||
component.players = samplePlayers;
|
||||
assert.equal(component.showLoadingPlaceholder, false);
|
||||
});
|
||||
|
||||
it('sorts the visible scouting board by selected stat', () => {
|
||||
const api = {
|
||||
searchPlayers: () => of({ count: samplePlayers.length, results: samplePlayers }),
|
||||
|
||||
Reference in New Issue
Block a user