All files / form/si-form-validation-tooltip si-form-validation-tooltip.component.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

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                  1x                               1x 4x    
/**
 * Copyright (c) Siemens 2016 - 2025
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, InjectionToken, Signal } from '@angular/core';
import { SiTranslatePipe } from '@siemens/element-translate-ng/translate';
 
import { SiFormError } from '../si-form-item/si-form-item.component';
 
export const SI_FORM_VALIDATION_TOOLTIP_DATA = new InjectionToken<Signal<SiFormError[]>>(
  'SiFormValidationTooltipData'
);
 
@Component({
  selector: 'si-form-validation-tooltip',
  imports: [SiTranslatePipe],
  template: `
    @for (error of errors(); track error.key) {
      <div>{{ error.message | translate: error.params }}</div>
    }
  `,
  host: {
    'class': 'd-flex flex-column gap-2'
  }
})
export class SiFormValidationTooltipComponent {
  protected errors = inject(SI_FORM_VALIDATION_TOOLTIP_DATA);
}