• 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

0.0
/src/core/behaviors/focus-control.ts
1
import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';
2
import { ElementRef, inject } from '@angular/core';
3
import { SafeAny } from 'ngx-tethys/types';
4
import { Subject } from 'rxjs';
5
import { takeUntil } from 'rxjs/operators';
6

×
UNCOV
7
class HostFocusControl {
×
UNCOV
8
    private ngUnsubscribe$ = new Subject<void>();
×
UNCOV
9

×
UNCOV
10
    private monitorElement: HTMLElement | ElementRef<HTMLElement>;
×
UNCOV
11

×
UNCOV
12
    elementRef = inject(ElementRef);
×
13

14
    focusMonitor = inject(FocusMonitor);
15

UNCOV
16
    focusChanged: (origin: FocusOrigin) => void = () => {};
×
17

18
    constructor(checkChildren: boolean = true, element?: HTMLElement | ElementRef<HTMLElement>) {
19
        this.monitorElement = element || this.elementRef.nativeElement;
20

×
21
        this.focusMonitor
22
            .monitor(this.monitorElement as SafeAny, checkChildren)
UNCOV
23
            .pipe(takeUntil(this.ngUnsubscribe$))
×
UNCOV
24
            .subscribe((origin: FocusOrigin) => {
×
UNCOV
25
                this.focusChanged(origin);
×
26
            });
27
    }
28

UNCOV
29
    focusVia(element: HTMLElement | ElementRef<HTMLElement>, origin: FocusOrigin, options?: FocusOptions): void {
×
30
        this.focusMonitor.focusVia(element as SafeAny, origin, options);
31
    }
32

33
    destroy() {
34
        this.ngUnsubscribe$.next();
35
        this.ngUnsubscribe$.complete();
36
        this.focusMonitor.stopMonitoring(this.monitorElement as SafeAny);
37
    }
38
}
39

40
export function useHostFocusControl(checkChildren?: boolean, element?: HTMLElement | ElementRef<HTMLElement>): HostFocusControl {
41
    return new HostFocusControl(checkChildren, element);
42
}
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