All files / select/select-option si-select-option-row.component.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

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 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                                          1x 131x 131x   131x 131x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import {
  booleanAttribute,
  ChangeDetectionStrategy,
  Component,
  input,
  TemplateRef
} from '@angular/core';
import { elementOk, addIcons, SiIconComponent } from '@siemens/element-ng/icon';
 
import { SiSelectOptionComponent } from '../select-option/si-select-option.component';
import { SelectOption } from '../si-select.types';
 
@Component({
  selector: 'si-select-option-row',
  imports: [SiIconComponent, SiSelectOptionComponent],
  templateUrl: './si-select-option-row.component.html',
  styleUrl: './si-select-option-row.component.scss',
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: {
    class: 'dropdown-item focus-none pe-4 gap-4',
    '[class.disabled]': '!!this.option().disabled',
    '[attr.aria-selected]': 'selected()',
    '[attr.data-id]': 'this.option().value'
  }
})
export class SiSelectOptionRowComponent {
  readonly option = input.required<SelectOption<unknown>>();
  readonly optionTemplate = input<TemplateRef<unknown>>();
  /** @defaultValue false */
  readonly selected = input(false, { transform: booleanAttribute });
  protected readonly icons = addIcons({ elementOk });
}