Skip to content

Commit

Permalink
Fixed mistake during refactor: filter autocomplete now working
Browse files Browse the repository at this point in the history
  • Loading branch information
second-slip committed May 29, 2024
1 parent 69ae49e commit 7f209d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

@if(_service.error()) {
<div class="alert alert-danger" data-testid="error">
<p data-testid="error-message">There was a problem retrieving the birds species list. Try to reload the page.</p>
Expand All @@ -17,7 +16,7 @@
<mat-spinner class="loading-spinner" matSuffix diameter="25"></mat-spinner>
}
<mat-autocomplete #autocomplete="matAutocomplete" [displayWith]="displayFn">
@for (bird of _service.birds(); track bird) {
@for (bird of filteredBirds | async; track bird) {
<mat-option [value]="bird">
{{bird.englishName}}
<!-- {{bird.englishName}} | <small>{{bird.birderStatus}}</small> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ describe('SelectSpeciesComponent', () => {
const input = await loader.getHarness(MatAutocompleteHarness.with({ selector: '#bird' }));
await input.focus();
const options = await input.getOptions({ text: /Blue/ });
await input.focus();

expect(options.length).toBe(1);
expect(await options[0].getText()).toBe('Blue Tit');
Expand Down
13 changes: 2 additions & 11 deletions src/app/_observation/select-species/select-species.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,8 @@ import { MatIconModule } from '@angular/material/icon';
@Component({
selector: 'app-select-species',
standalone: true,
imports: [
FormsModule,
MatFormFieldModule,
MatInputModule,
MatAutocompleteModule,
MatButtonModule,
MatIconModule,
MatProgressSpinnerModule,
ReactiveFormsModule,
CommonModule
],
imports: [FormsModule, ReactiveFormsModule, CommonModule,
MatFormFieldModule, MatInputModule, MatAutocompleteModule, MatButtonModule, MatIconModule, MatProgressSpinnerModule],
templateUrl: './select-species.component.html',
styleUrl: './select-species.component.scss'
})
Expand Down

0 comments on commit 7f209d2

Please sign in to comment.