• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.79
/src/form/validator/unique-validator.directive.ts
1
import { AsyncValidator, AbstractControl, ValidationErrors, NG_ASYNC_VALIDATORS } from '@angular/forms';
2
import { Directive, ElementRef, inject, input } from '@angular/core';
3
import { Observable, of } from 'rxjs';
4
import { map, catchError } from 'rxjs/operators';
5
import { ThyFormDirective } from '../form.directive';
6

7
/**
8
 * 用于校验表单控件的输入值是否已经存在
9
 * @name thyUniqueCheck
10
 * @order 20
11
 */
12
@Directive({
13
    selector: '[thyUniqueCheck]',
1✔
14
    providers: [{ provide: NG_ASYNC_VALIDATORS, useExisting: ThyUniqueCheckValidator, multi: true }]
UNCOV
15
})
×
UNCOV
16
export class ThyUniqueCheckValidator implements AsyncValidator {
×
UNCOV
17
    private elementRef = inject(ElementRef);
×
18
    private thyForm = inject(ThyFormDirective, { optional: true })!;
19

UNCOV
20
    readonly thyUniqueCheck = input<(value: any) => Observable<boolean>>(undefined);
×
UNCOV
21

×
UNCOV
22
    validate(ctrl: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
×
UNCOV
23
        return this.thyUniqueCheck()(ctrl.value).pipe(
×
24
            map((failed: boolean) => {
25
                setTimeout(() => {
UNCOV
26
                    if (failed && this.thyForm && this.elementRef.nativeElement.name) {
×
UNCOV
27
                        this.thyForm.validator.validateControl(this.elementRef.nativeElement.name);
×
28
                    }
29
                });
1✔
30
                return failed ? { thyUniqueCheck: failed } : null;
31
            }),
32
            catchError(() => of(null))
33
        );
1✔
34
    }
35
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc