All files / lib/focusable-hint focusable-hint.component.ts

94.23% Statements 49/52
100% Branches 2/2
50% Functions 1/2
94.23% Lines 49/52

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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 531x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 1x 1x 1x       1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import {
  Component,
  ElementRef,
  HostBinding,
  Input,
  inject,
} from '@angular/core';
 
import { FocusableElementOwner } from '../utils/util.types';
 
/**
 * A focusable text component with optional icon and no additional interactivity.
 */
@Component({
  selector: 'gc-focusable-hint',
  templateUrl: './focusable-hint.component.html',
  styleUrls: ['./focusable-hint.component.css'],
  standalone: false,
})
export class FocusableHintComponent implements FocusableElementOwner {
  /**
   * Text to make focusable.
   */
  @Input({ required: true })
  text = '';
 
  /**
   * Decides whether the passed icon will be shown.
   */
  @Input()
  @HostBinding('class.gc-has-icon')
  showIcon = false;
 
  /** @ignore */
  @HostBinding('tabindex')
  private readonly tabindex = 0;
 
  /** @ignore */
  private readonly elRef = inject<ElementRef<HTMLElement>>(
    ElementRef<HTMLElement>,
  );
 
  focusChild(): boolean {
    this.elRef.nativeElement.focus();
    return true;
  }
}