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

atinc / ngx-tethys / 5fa9630c-19a1-4ee7-af3d-6a0c3535952a

08 Oct 2024 08:24AM UTC coverage: 90.438% (+0.007%) from 90.431%
5fa9630c-19a1-4ee7-af3d-6a0c3535952a

push

circleci

minlovehua
refactor: refactor all control-flow directives to new control-flow #TINFR-381

5511 of 6738 branches covered (81.79%)

Branch coverage included in aggregate %.

98 of 104 new or added lines in 58 files covered. (94.23%)

113 existing lines in 17 files now uncovered.

13253 of 14010 relevant lines covered (94.6%)

991.73 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 { Component, Input, HostBinding, ElementRef, ChangeDetectorRef, Inject, HostListener, Optional } from '@angular/core';
2
import { Highlightable } from '@angular/cdk/a11y';
3
import { IThyListOptionParentComponent, THY_LIST_OPTION_PARENT_COMPONENT } from '../option.token';
4
import { ThyIcon } from 'ngx-tethys/icon';
5

6
import { coerceBooleanProperty } from 'ngx-tethys/util';
7

1✔
8
let _uniqueIdCounter = 0;
9

10
export type ThyListLayout = 'list' | 'grid';
11

12
/**
1✔
13
 * @private
14
 * @order 30
494✔
15
 */
16
@Component({
17
    selector: 'thy-list-option,[thy-list-option]',
494✔
18
    templateUrl: './list-option.component.html',
19
    standalone: true,
NEW
20
    imports: [ThyIcon]
×
21
})
22
export class ThyListOption implements Highlightable {
23
    @HostBinding(`class.thy-list-option`)
494✔
24
    get _isListOption() {
25
        return this.parentSelectionList.layout === 'list';
26
    }
27

28
    @HostBinding(`class.thy-grid-option`)
111✔
29
    get _parentLayout() {
111✔
30
        return this.parentSelectionList.layout === 'grid';
111✔
31
    }
111✔
32

111✔
33
    @HostBinding(`attr.role`) _role = 'option';
111✔
34

35
    @HostBinding(`attr.tabindex`) _tabIndex = -1;
36

6!
37
    @Input() id = `thy-list-option-${_uniqueIdCounter++}`;
6✔
38

6✔
39
    @Input() thyValue: any;
40

41
    @Input({ transform: coerceBooleanProperty })
42
    set thyDisabled(value: boolean) {
43
        this.disabled = value;
44
    }
45

46
    @HostBinding(`class.disabled`) disabled?: boolean;
47

48
    /** Whether the option is selected. */
49
    @HostBinding(`class.active`)
50
    get selected() {
13✔
51
        return this.parentSelectionList.isSelected(this);
13✔
52
    }
53

54
    constructor(
3✔
55
        public element: ElementRef<HTMLElement>,
56
        private changeDetector: ChangeDetectorRef,
57
        /** @docs-private */
58
        @Optional() @Inject(THY_LIST_OPTION_PARENT_COMPONENT) public parentSelectionList: IThyListOptionParentComponent
59
    ) {}
60

UNCOV
61
    @HostListener('click', ['$event'])
×
62
    onClick(event: Event) {
63
        if (this.parentSelectionList.multiple || !this.parentSelectionList.isSelected(this)) {
1✔
64
            this.parentSelectionList.toggleOption(this, event);
65
            this.parentSelectionList.setActiveOption(this);
66
        }
67
    }
68

1✔
69
    // @HostListener('focus', ['$event'])
70
    // onFocus(event: Event) {
71
    //     this.parentSelectionList.setFocusedOption(this, event);
72
    // }
73

74
    /** Allows for programmatic focusing of the option. */
75
    // focus(origin?: FocusOrigin): void {
76
    //     this.element.nativeElement.focus();
77
    // }
78

79
    setActiveStyles(): void {
80
        this.element.nativeElement.classList.add('hover');
81
        this.parentSelectionList.scrollIntoView(this);
1✔
82
    }
83

84
    setInactiveStyles(): void {
85
        this.element.nativeElement.classList.remove('hover');
86
    }
87

88
    /**
89
     * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
90
     * @docs-private
91
     */
92
    getLabel() {
93
        return '';
94
    }
95
}
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