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

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

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

40.74
/projects/igniteui-angular/src/lib/combo/combo-item.component.ts
1
import {
2
    Component,
3
    ElementRef,
4
    HostBinding,
5
    Inject,
6
    Input,
7
    booleanAttribute
8
} from '@angular/core';
9
import { IgxDropDownItemComponent } from '../drop-down/drop-down-item.component';
10
import { IGX_DROPDOWN_BASE, IDropDownBase, Navigate } from '../drop-down/drop-down.common';
11
import { IgxComboAPIService } from './combo.api';
12
import { IgxSelectionAPIService } from '../core/selection';
13
import { rem } from '../core/utils';
14
import { IgxCheckboxComponent } from '../checkbox/checkbox.component';
15
import { NgIf } from '@angular/common';
16

17
/** @hidden */
18
@Component({
19
    selector: 'igx-combo-item',
20
    templateUrl: 'combo-item.component.html',
21
    imports: [NgIf, IgxCheckboxComponent]
22
})
23
export class IgxComboItemComponent extends IgxDropDownItemComponent {
2✔
24

25
    /**
26
     * Gets the height of a list item
27
     *
28
     * @hidden
29
     */
30
    @Input()
31
    public itemHeight: string | number = '';
269✔
32

33
    /** @hidden @internal */
34
    @HostBinding('style.height.rem')
35
    public get _itemHeightToRem() {
36
        if (this.itemHeight) {
4,908!
UNCOV
37
            return rem(this.itemHeight);
×
38
        }
39
    }
40

41
    @HostBinding('attr.aria-label')
42
    @Input()
43
    public override get ariaLabel(): string {
44
        const valueKey = this.comboAPI.valueKey;
9,816✔
45
        return (valueKey !== null && this.value != null) ? this.value[valueKey] : this.value;
9,816!
46
    }
47

48
    /** @hidden @internal */
49
    @Input({ transform: booleanAttribute })
50
    public singleMode: boolean;
51

52
    /**
53
     * @hidden
54
     */
55
    public override get itemID() {
56
        const valueKey = this.comboAPI.valueKey;
14,724✔
57
        return valueKey !== null ? this.value[valueKey] : this.value;
14,724!
58
    }
59

60
    /**
61
     * @hidden
62
     */
63
    public get comboID() {
64
        return this.comboAPI.comboID;
×
65
    }
66

67
    /**
68
     * @hidden
69
     * @internal
70
     */
71
    public get disableTransitions() {
72
        return this.comboAPI.disableTransitions;
4,908✔
73
    }
74

75
    constructor(
76
        protected comboAPI: IgxComboAPIService,
269✔
77
        @Inject(IGX_DROPDOWN_BASE) dropDown: IDropDownBase,
78
        elementRef: ElementRef,
79
        @Inject(IgxSelectionAPIService) selection: IgxSelectionAPIService
80
    ) {
81
        super(dropDown, elementRef, null, selection);
269✔
82
    }
83

84
    /**
85
     * @hidden
86
     */
87
    public override get selected(): boolean {
88
        return this.comboAPI.is_item_selected(this.itemID);
14,724✔
89
    }
90

91
    public override set selected(value: boolean) {
92
        if (this.isHeader) {
×
93
            return;
×
94
        }
95
        this._selected = value;
×
96
    }
97

98
    /**
99
     * @hidden
100
     */
101
    public isVisible(direction: Navigate): boolean {
102
        const rect = this.element.nativeElement.getBoundingClientRect();
×
103
        const parentDiv = this.element.nativeElement.parentElement.parentElement.getBoundingClientRect();
×
104
        if (direction === Navigate.Down) {
×
105
            return rect.y + rect.height <= parentDiv.y + parentDiv.height;
×
106
        }
107
        return rect.y >= parentDiv.y;
×
108
    }
109

110
    public override clicked(event): void {
UNCOV
111
        this.comboAPI.disableTransitions = false;
×
UNCOV
112
        if (!this.isSelectable) {
×
UNCOV
113
            return;
×
114
        }
UNCOV
115
        this.dropDown.navigateItem(this.index);
×
UNCOV
116
        this.comboAPI.set_selected_item(this.itemID, event);
×
117
    }
118

119
    /**
120
     * @hidden
121
     * @internal
122
     * The event that is prevented is the click on the checkbox label element.
123
     * That is the only visible element that a user can interact with.
124
     * The click propagates to the host and the preventDefault is to stop it from
125
     * switching focus to the input it's base on.
126
     * The toggle happens in an internal handler in the drop-down on the next task queue cycle.
127
     */
128
    public disableCheck(event: MouseEvent) {
UNCOV
129
        event.preventDefault();
×
130
    }
131
}
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