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

100% Statements 20/20
100% Branches 3/3
100% Functions 2/2
100% Lines 20/20

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 211x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 149x 149x 149x 1x  
import { Directive, ElementRef, Input } 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;
 
  constructor(private readonly el: ElementRef) {}
 
  scrollIntoView(): void {
    const element = this.el.nativeElement as HTMLElement;
    element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
  }
}