All files / app/shared/components/filters filters.component.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 214x 4x               4x 34x 34x 34x   34x     2x      
import { FilterEntry, isFilterGroup } from '../../models/filter.model';
import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
 
@Component({
    selector: 'app-filters',
    templateUrl: './filters.component.html',
    styleUrl: './filters.component.scss',
    changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FiltersComponent<T extends string = string> {
    readonly filters = input.required<readonly FilterEntry<T>[]>();
    readonly activeFilter = input.required<T>();
    readonly filterChange = output<T>();
 
    readonly isFilterGroup = isFilterGroup;
 
    onSelect(filter: T): void {
        this.filterChange.emit(filter);
    }
}