diff --git a/adev/src/app/features/references/api-item-label/api-item-label.component.html b/adev/src/app/features/references/api-item-label/api-item-label.component.html index 35b5a422b7c..78ca49801f5 100644 --- a/adev/src/app/features/references/api-item-label/api-item-label.component.html +++ b/adev/src/app/features/references/api-item-label/api-item-label.component.html @@ -1,3 +1 @@ -@if (apiItemType()) { - {{ apiItemType()! | adevApiLabel: labelMode() }} -} +{{ type() | adevApiLabel: mode() }} diff --git a/adev/src/app/features/references/api-item-label/api-item-label.component.spec.ts b/adev/src/app/features/references/api-item-label/api-item-label.component.spec.ts index 7a74c8e3343..9f8c1b0040e 100644 --- a/adev/src/app/features/references/api-item-label/api-item-label.component.spec.ts +++ b/adev/src/app/features/references/api-item-label/api-item-label.component.spec.ts @@ -25,7 +25,7 @@ describe('ApiItemLabel', () => { }); it('should by default display short label for Class', () => { - component.type = ApiItemType.CLASS; + fixture.componentRef.setInput('type', ApiItemType.CLASS); fixture.detectChanges(); const label = fixture.nativeElement.innerText; @@ -34,8 +34,8 @@ describe('ApiItemLabel', () => { }); it('should display full label for Class when labelMode equals full', () => { - component.type = ApiItemType.CLASS; - component.mode = 'full'; + fixture.componentRef.setInput('type', ApiItemType.CLASS); + fixture.componentRef.setInput('mode', 'full'); fixture.detectChanges(); const label = fixture.nativeElement.innerText; @@ -44,8 +44,8 @@ describe('ApiItemLabel', () => { }); it('should display short label for Class when labelMode equals short', () => { - component.type = ApiItemType.CLASS; - component.mode = 'short'; + fixture.componentRef.setInput('type', ApiItemType.CLASS); + fixture.componentRef.setInput('mode', 'short'); fixture.detectChanges(); const label = fixture.nativeElement.innerText; diff --git a/adev/src/app/features/references/api-item-label/api-item-label.component.ts b/adev/src/app/features/references/api-item-label/api-item-label.component.ts index 882dd139079..cb748dad795 100644 --- a/adev/src/app/features/references/api-item-label/api-item-label.component.ts +++ b/adev/src/app/features/references/api-item-label/api-item-label.component.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ -import {ChangeDetectionStrategy, Component, Input, signal} from '@angular/core'; +import {ChangeDetectionStrategy, Component, input} from '@angular/core'; import {ApiItemType} from '../interfaces/api-item-type'; import {ApiLabel} from '../pipes/api-label.pipe'; @@ -16,19 +16,12 @@ import {ApiLabel} from '../pipes/api-label.pipe'; templateUrl: './api-item-label.component.html', changeDetection: ChangeDetectionStrategy.OnPush, host: { - '[attr.data-type]': 'apiItemType()', - '[attr.data-mode]': 'labelMode()', + '[attr.data-type]': 'type()', + '[attr.data-mode]': 'mode()', }, imports: [ApiLabel], }) export default class ApiItemLabel { - @Input({required: true}) set type(value: ApiItemType) { - this.apiItemType.set(value); - } - @Input({required: true}) set mode(value: 'short' | 'full') { - this.labelMode.set(value); - } - - protected apiItemType = signal(undefined); - protected labelMode = signal<'short' | 'full'>('short'); + readonly type = input.required(); + readonly mode = input.required<'short' | 'full'>(); } diff --git a/adev/src/app/features/references/api-items-section/api-items-section.component.html b/adev/src/app/features/references/api-items-section/api-items-section.component.html index 459f343ee61..45f53ec8fed 100644 --- a/adev/src/app/features/references/api-items-section/api-items-section.component.html +++ b/adev/src/app/features/references/api-items-section/api-items-section.component.html @@ -1,22 +1,22 @@
-

- @if (group.isFeatured) { +

+ @if (group().isFeatured) { star }