All files / lib/internal combobox-option.directive.ts

100% Statements 21/21
100% Branches 2/2
100% Functions 2/2
100% Lines 21/21

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 221x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1934x 1934x 1934x 1x 1x 123x 123x 123x 1x  
import { Directive, ElementRef, Input, inject } from '@angular/core';
 
import { IndexedItem } from '../utils/internal-utils';
import { Item } from '../utils/util.types';
 
@Directive({
  selector: '[data-gc-combobox-option]',
  standalone: false,
})
export class ComboBoxOptionDirective<T, I extends Item> {
  @Input('data-gc-combobox-option')
  public item: IndexedItem<T, I> | undefined;
 
  /** @ignore */
  private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);
 
  scrollIntoView(): void {
    const element = this.el.nativeElement;
    element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
  }
}