• 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

10.0
/src/shared/directives/thy-show.ts
1
import { Directive, Renderer2, Input, ElementRef, Output, EventEmitter, OnDestroy, NgZone, inject } from '@angular/core';
2
import { useHostRenderer } from '@tethys/cdk/dom';
3
import { coerceBooleanProperty } from 'ngx-tethys/util';
4

5
/**
6
 * @name thyShow
7
 */
8
@Directive({
1✔
9
    selector: '[thyShow]'
UNCOV
10
})
×
UNCOV
11
export class ThyShowDirective implements OnDestroy {
×
UNCOV
12
    private elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
×
UNCOV
13
    private renderer = inject(Renderer2);
×
UNCOV
14
    private ngZone = inject(NgZone);
×
15

16
    @Output() thyShowChange = new EventEmitter();
UNCOV
17

×
UNCOV
18
    private hostRenderer = useHostRenderer();
×
UNCOV
19

×
20
    private unListenEvent: () => void;
21

22
    private unListenDocument() {
UNCOV
23
        if (this.unListenEvent) {
×
UNCOV
24
            this.unListenEvent();
×
UNCOV
25
            this.unListenEvent = null;
×
UNCOV
26
        }
×
27
    }
×
28

×
29
    @Input({ transform: coerceBooleanProperty })
×
30
    set thyShow(condition: boolean) {
31
        if (condition) {
×
32
            this.hostRenderer.setStyle('display', 'block');
33
            this.ngZone.runOutsideAngular(() =>
34
                setTimeout(() => {
35
                    this.unListenEvent = this.renderer.listen('document', 'click', event => {
36
                        if (!this.elementRef.nativeElement.contains(event.target)) {
UNCOV
37
                            if (this.thyShowChange.observers.length) {
×
UNCOV
38
                                this.ngZone.run(() => this.thyShowChange.emit(false));
×
39
                            }
40
                            this.unListenDocument();
41
                        }
UNCOV
42
                    });
×
43
                })
44
            );
1✔
45
        } else {
46
            this.hostRenderer.setStyle('display', 'none');
47
            this.unListenDocument();
48
        }
49
    }
1✔
50

51
    ngOnDestroy() {
52
        this.unListenDocument();
53
    }
54
}
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