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

atinc / ngx-tethys / 881c8997-29c3-4d01-9ef1-22092f16cec2

03 Apr 2024 03:31AM UTC coverage: 90.404% (-0.2%) from 90.585%
881c8997-29c3-4d01-9ef1-22092f16cec2

Pull #3062

circleci

minlovehua
refactor(all): use the transform attribute of @input() instead of @InputBoolean() and @InputNumber()
Pull Request #3062: refactor(all): use the transform attribute of @input() instead of @InputBoolean() and @InputNumber()

5411 of 6635 branches covered (81.55%)

Branch coverage included in aggregate %.

217 of 223 new or added lines in 82 files covered. (97.31%)

201 existing lines in 53 files now uncovered.

13176 of 13925 relevant lines covered (94.62%)

980.1 hits per line

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

88.46
/src/shared/option/list-option/list-option.component.ts
1
import {
2
    Component,
3
    Input,
4
    HostBinding,
5
    ElementRef,
6
    ChangeDetectorRef,
7
    Inject,
1✔
8
    HostListener,
9
    Optional,
10
    booleanAttribute
11
} from '@angular/core';
12
import { Highlightable } from '@angular/cdk/a11y';
1✔
13
import { IThyListOptionParentComponent, THY_LIST_OPTION_PARENT_COMPONENT } from '../option.token';
14
import { ThyIcon } from 'ngx-tethys/icon';
494✔
15
import { NgIf } from '@angular/common';
16

17
let _uniqueIdCounter = 0;
494✔
18

19
export type ThyListLayout = 'list' | 'grid';
UNCOV
20

×
21
/**
22
 * @private
23
 * @order 30
494✔
24
 */
25
@Component({
26
    selector: 'thy-list-option,[thy-list-option]',
27
    templateUrl: './list-option.component.html',
28
    standalone: true,
111✔
29
    imports: [NgIf, ThyIcon]
111✔
30
})
111✔
31
export class ThyListOption implements Highlightable {
111✔
32
    @HostBinding(`class.thy-list-option`)
111✔
33
    get _isListOption() {
111✔
34
        return this.parentSelectionList.layout === 'list';
35
    }
36

6!
37
    @HostBinding(`class.thy-grid-option`)
6✔
38
    get _parentLayout() {
6✔
39
        return this.parentSelectionList.layout === 'grid';
40
    }
41

42
    @HostBinding(`attr.role`) _role = 'option';
43

44
    @HostBinding(`attr.tabindex`) _tabIndex = -1;
45

46
    @Input() id = `thy-list-option-${_uniqueIdCounter++}`;
47

48
    @Input() thyValue: any;
49

50
    @Input({ transform: booleanAttribute })
13✔
51
    set thyDisabled(value: boolean) {
13✔
52
        this.disabled = value;
53
    }
54

3✔
55
    @HostBinding(`class.disabled`) disabled?: boolean;
56

57
    /** Whether the option is selected. */
58
    @HostBinding(`class.active`)
59
    get selected() {
60
        return this.parentSelectionList.isSelected(this);
UNCOV
61
    }
×
62

63
    constructor(
1✔
64
        public element: ElementRef<HTMLElement>,
65
        private changeDetector: ChangeDetectorRef,
66
        /** @docs-private */
67
        @Optional() @Inject(THY_LIST_OPTION_PARENT_COMPONENT) public parentSelectionList: IThyListOptionParentComponent
68
    ) {}
1✔
69

70
    @HostListener('click', ['$event'])
71
    onClick(event: Event) {
72
        if (this.parentSelectionList.multiple || !this.parentSelectionList.isSelected(this)) {
73
            this.parentSelectionList.toggleOption(this, event);
74
            this.parentSelectionList.setActiveOption(this);
75
        }
76
    }
77

78
    // @HostListener('focus', ['$event'])
79
    // onFocus(event: Event) {
80
    //     this.parentSelectionList.setFocusedOption(this, event);
81
    // }
1✔
82

83
    /** Allows for programmatic focusing of the option. */
84
    // focus(origin?: FocusOrigin): void {
85
    //     this.element.nativeElement.focus();
86
    // }
87

88
    setActiveStyles(): void {
89
        this.element.nativeElement.classList.add('hover');
90
        this.parentSelectionList.scrollIntoView(this);
91
    }
92

93
    setInactiveStyles(): void {
94
        this.element.nativeElement.classList.remove('hover');
95
    }
96

97
    /**
98
     * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
99
     * @docs-private
100
     */
101
    getLabel() {
102
        return '';
103
    }
104
}
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