fix: use select control for role filter

This commit is contained in:
bisco
2026-06-03 23:10:00 +02:00
parent 03b8762835
commit 8909be9694
3 changed files with 50 additions and 6 deletions
+18
View File
@@ -89,6 +89,24 @@ describe('AppComponent', () => {
assert.equal(calls, 1);
});
it('exposes role options and sends the selected role as a filter', () => {
let requestedRole = '';
const api = {
searchPlayers: (filters: { role: string }) => {
requestedRole = filters.role;
return of({ count: 0, results: [] });
},
} as unknown as PlayerApiService;
const component = new AppComponent(api);
assert.ok(component.roles.includes('3 and D wing'));
component.filters.role = '3 and D wing';
component.search();
assert.equal(requestedRole, '3 and D wing');
});
it('shows the loading placeholder only before results exist', () => {
const api = {
searchPlayers: () => of({ count: samplePlayers.length, results: samplePlayers }),