Skip to content

Commit 6f6b240

Browse files
kirjsAndrewKushnir
authored andcommitted
refactor(forms): convert Signal Forms errors to use RuntimeError
- Added 13 new error codes to forms/src/errors.ts (1900-1999) - use RuntimeError
1 parent 9f5744a commit 6f6b240

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

adev/src/app/features/references/api-reference-list/api-reference-list.component.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {RouterTestingHarness} from '@angular/router/testing';
1616
import {provideRouter} from '@angular/router';
1717
import {Location} from '@angular/common';
1818
import {By} from '@angular/platform-browser';
19-
import {NavigationItem, TextField} from '@angular/docs';
19+
import {TextField} from '@angular/docs';
2020
import {ApiItem} from '../interfaces/api-item';
2121

2222
describe('ApiReferenceList', () => {
@@ -117,6 +117,15 @@ describe('ApiReferenceList', () => {
117117
expect(component.filteredGroups()![0].items).toEqual([fakeItem1]);
118118
});
119119

120+
it('should display items which match the query by group title', () => {
121+
fixture.componentRef.setInput('query', 'Fake Group');
122+
fixture.detectChanges();
123+
124+
// Should find all items whose group title contains the query
125+
expect(component.filteredGroups()![0].items.length).toBeGreaterThan(0);
126+
expect(component.filteredGroups()![0].items).toContain(fakeItem1);
127+
});
128+
120129
it('should display only class items when user selects Class in the Type select', () => {
121130
fixture.componentRef.setInput('type', ApiItemType.CLASS);
122131
fixture.detectChanges();

adev/src/app/features/references/api-reference-list/api-reference-list.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ export default class ApiReferenceList {
9797
id: group.id,
9898
items: group.items.filter((apiItem) => {
9999
return (
100-
(query == '' ? true : apiItem.title.toLocaleLowerCase().includes(query)) &&
100+
(query == ''
101+
? true
102+
: apiItem.title.toLocaleLowerCase().includes(query) ||
103+
group.title.toLocaleLowerCase().includes(query)) &&
101104
(type === ALL_TYPES_KEY || apiItem.itemType === type) &&
102105
((status & STATUSES.stable &&
103106
!apiItem.developerPreview &&

0 commit comments

Comments
 (0)