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

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

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

22.22
/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 { coerceBooleanProperty } from 'ngx-tethys/util';
4
import { IThyListOptionParentComponent, THY_LIST_OPTION_PARENT_COMPONENT } from '../option.token';
5
import { ThyIconComponent } from 'ngx-tethys/icon';
6
import { NgIf } from '@angular/common';
7
import { InputBoolean } from 'ngx-tethys/core';
8

9
let _uniqueIdCounter = 0;
1✔
10

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

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

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

×
34
    @HostBinding(`attr.role`) _role = 'option';
×
35

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

38
    @Input() id = `thy-list-option-${_uniqueIdCounter++}`;
×
39

×
40
    @Input() thyValue: any;
×
41

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

48
    @HostBinding(`class.disabled`) disabled?: boolean;
49

50
    /** Whether the option is selected. */
51
    @HostBinding(`class.active`)
52
    get selected() {
×
53
        return this.parentSelectionList.isSelected(this);
×
54
    }
55

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

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

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

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

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

86
    setInactiveStyles(): void {
87
        this.element.nativeElement.classList.remove('hover');
88
    }
1✔
89

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