fix: allow returning from player detail to results

This commit is contained in:
bisco
2026-06-03 23:15:30 +02:00
parent f44a07f231
commit f87f62f111
4 changed files with 66 additions and 9 deletions
+16
View File
@@ -71,6 +71,7 @@ describe('AppComponent', () => {
assert.equal(component.resultCount, 2);
assert.equal(component.averagePoints, '14.00');
assert.equal(component.topEfficiencyPlayer?.name, 'Luca Marini');
assert.equal(component.selectedPlayer, null);
});
it('reacts to filter changes without requiring the search button', () => {
@@ -131,4 +132,19 @@ describe('AppComponent', () => {
assert.equal(component.players[0].name, 'Mateo Santos');
});
it('opens and closes a player profile without losing the filtered list', () => {
const api = {
searchPlayers: () => of({ count: samplePlayers.length, results: samplePlayers }),
} as unknown as PlayerApiService;
const component = new AppComponent(api);
component.search();
component.selectPlayer(samplePlayers[0]);
component.returnToResults();
assert.equal(component.selectedPlayer, null);
assert.equal(component.players.length, 2);
assert.equal(component.resultCount, 2);
});
});