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

IgniteUI / igniteui-angular / 23353730325

20 Mar 2026 05:03PM UTC coverage: 9.784% (-79.5%) from 89.264%
23353730325

Pull #17069

github

web-flow
Merge cfa7e86d1 into a4dc50177
Pull Request #17069: fix(IgxGrid): Do not apply width constraint to groups.

921 of 16963 branches covered (5.43%)

Branch coverage included in aggregate %.

1 of 3 new or added lines in 1 file covered. (33.33%)

25213 existing lines in 340 files now uncovered.

3842 of 31721 relevant lines covered (12.11%)

6.13 hits per line

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

0.99
/projects/igniteui-angular/combo/src/combo/combo-dropdown.component.ts
1
import { Component, QueryList, OnDestroy, AfterViewInit, ContentChildren, Input, booleanAttribute, inject } from '@angular/core';
2
import { IgxComboBase, IGX_COMBO_COMPONENT } from './combo.common';
3
import { IgxComboAddItemComponent } from './combo-add-item.component';
4
import { IgxComboAPIService } from './combo.api';
5
import { IgxComboItemComponent } from './combo-item.component';
6
import { IgxToggleDirective } from 'igniteui-angular/directives';
7
import { DropDownActionKey, IDropDownBase, IGX_DROPDOWN_BASE, IgxDropDownComponent, IgxDropDownItemBaseDirective } from 'igniteui-angular/drop-down';
8

9
/** @hidden */
10
@Component({
11
    selector: 'igx-combo-drop-down',
12
    templateUrl: '../../../drop-down/src/drop-down/drop-down.component.html',
13
    providers: [{ provide: IGX_DROPDOWN_BASE, useExisting: IgxComboDropDownComponent }],
14
    imports: [IgxToggleDirective]
15
})
16
export class IgxComboDropDownComponent extends IgxDropDownComponent implements IDropDownBase, OnDestroy, AfterViewInit {
3✔
UNCOV
17
    public combo = inject<IgxComboBase>(IGX_COMBO_COMPONENT);
×
UNCOV
18
    protected comboAPI = inject(IgxComboAPIService);
×
19

20
    /** @hidden @internal */
21
    @Input({ transform: booleanAttribute })
UNCOV
22
    public singleMode = false;
×
23

24
    /**
25
     * @hidden
26
     * @internal
27
     */
28
    @ContentChildren(IgxComboItemComponent, { descendants: true })
UNCOV
29
    public override children: QueryList<IgxDropDownItemBaseDirective> = null;
×
30

31
    /** @hidden @internal */
32
    public override get scrollContainer(): HTMLElement {
33
        // TODO: Update, use public API if possible:
UNCOV
34
        return this.virtDir.dc.location.nativeElement;
×
35
    }
36

37
    protected get isScrolledToLast(): boolean {
38
        const scrollTop = this.virtDir.scrollPosition;
×
39
        const scrollHeight = this.virtDir.getScroll().scrollHeight;
×
40
        return Math.floor(scrollTop + this.virtDir.igxForContainerSize) === scrollHeight;
×
41
    }
42

43
    protected get lastVisibleIndex(): number {
44
        return this.combo.totalItemCount ?
×
45
            Math.floor(this.combo.itemsMaxHeight / this.combo.itemHeight) :
46
            this.items.length - 1;
47
    }
48

49
    protected get sortedChildren(): IgxDropDownItemBaseDirective[] {
UNCOV
50
        if (this.children !== undefined) {
×
UNCOV
51
            return this.children.toArray()
×
UNCOV
52
                .sort((a: IgxDropDownItemBaseDirective, b: IgxDropDownItemBaseDirective) => a.index - b.index);
×
53
        }
54
        return null;
×
55
    }
56

57
    /**
58
     * Get all non-header items
59
     *
60
     * ```typescript
61
     * let myDropDownItems = this.dropdown.items;
62
     * ```
63
     */
64
    public override get items(): IgxComboItemComponent[] {
UNCOV
65
        const items: IgxComboItemComponent[] = [];
×
UNCOV
66
        if (this.children !== undefined) {
×
UNCOV
67
            const sortedChildren = this.sortedChildren as IgxComboItemComponent[];
×
UNCOV
68
            for (const child of sortedChildren) {
×
UNCOV
69
                if (!child.isHeader) {
×
UNCOV
70
                    items.push(child);
×
71
                }
72
            }
73
        }
74

UNCOV
75
        return items;
×
76
    }
77

78
    /**
79
     * @hidden @internal
80
     */
81
    public onFocus() {
UNCOV
82
        this.focusedItem = this._focusedItem || this.items[0];
×
UNCOV
83
        this.combo.setActiveDescendant();
×
84
    }
85

86
    /**
87
     * @hidden @internal
88
     */
89
    public onBlur(_evt?) {
UNCOV
90
        this.focusedItem = null;
×
UNCOV
91
        this.combo.setActiveDescendant();
×
92
    }
93

94
    /**
95
     * @hidden @internal
96
     */
97
    public override onToggleOpened() {
UNCOV
98
        this.opened.emit();
×
99
    }
100

101
    /**
102
     * @hidden
103
     */
104
    public override navigateFirst() {
UNCOV
105
        this.navigateItem(this.virtDir.igxForOf.findIndex(e => !e?.isHeader));
×
UNCOV
106
        this.combo.setActiveDescendant();
×
107
    }
108

109
    /**
110
     * @hidden
111
     */
112
    public override navigatePrev() {
UNCOV
113
        if (this._focusedItem && this._focusedItem.index === 0 && this.virtDir.state.startIndex === 0) {
×
UNCOV
114
            this.combo.focusSearchInput(false);
×
UNCOV
115
            this.focusedItem = null;
×
116
        } else {
UNCOV
117
            super.navigatePrev();
×
118
        }
UNCOV
119
        this.combo.setActiveDescendant();
×
120
    }
121

122

123
    /**
124
     * @hidden
125
     */
126
    public override navigateNext() {
UNCOV
127
        const lastIndex = this.combo.totalItemCount ? this.combo.totalItemCount - 1 : this.virtDir.igxForOf.length - 1;
×
UNCOV
128
        if (this._focusedItem && this._focusedItem.index === lastIndex) {
×
UNCOV
129
            this.focusAddItemButton();
×
130
        } else {
UNCOV
131
            super.navigateNext();
×
132
        }
UNCOV
133
        this.combo.setActiveDescendant();
×
134
    }
135

136
    /**
137
     * @hidden @internal
138
     */
139
    public override selectItem(item: IgxDropDownItemBaseDirective) {
UNCOV
140
        if (item === null || item === undefined) {
×
141
            return;
×
142
        }
UNCOV
143
        this.comboAPI.set_selected_item(item.itemID);
×
UNCOV
144
        this._focusedItem = item;
×
UNCOV
145
        this.combo.setActiveDescendant();
×
146
    }
147

148
    /**
149
     * @hidden @internal
150
     */
151
    public override updateScrollPosition() {
UNCOV
152
        this.virtDir.getScroll().scrollTop = this._scrollPosition;
×
153
    }
154

155
    /**
156
     * @hidden @internal
157
     */
158
    public override onItemActionKey(key: DropDownActionKey, event?: KeyboardEvent) {
UNCOV
159
        switch (key) {
×
160
            case DropDownActionKey.ENTER:
UNCOV
161
                this.handleEnter();
×
UNCOV
162
                break;
×
163
            case DropDownActionKey.SPACE:
UNCOV
164
                this.handleSpace();
×
UNCOV
165
                break;
×
166
            case DropDownActionKey.ESCAPE:
UNCOV
167
                this.close();
×
UNCOV
168
                break;
×
169
            case DropDownActionKey.TAB:
UNCOV
170
                this.close(event);
×
171
        }
172
    }
173

174
    public override ngAfterViewInit() {
UNCOV
175
        this.virtDir.getScroll().addEventListener('scroll', this.scrollHandler);
×
176
    }
177

178
    /**
179
     * @hidden @internal
180
     */
181
    public override ngOnDestroy(): void {
UNCOV
182
        this.virtDir.getScroll().removeEventListener('scroll', this.scrollHandler);
×
UNCOV
183
        super.ngOnDestroy();
×
184
    }
185

186
    protected override scrollToHiddenItem(_newItem: any): void { }
187

UNCOV
188
    protected scrollHandler = () => {
×
UNCOV
189
        this.comboAPI.disableTransitions = true;
×
190
    };
191

192
    private handleEnter() {
UNCOV
193
        if (this.isAddItemFocused()) {
×
UNCOV
194
            this.combo.addItemToCollection();
×
UNCOV
195
            return;
×
196
        }
197
        if (this.singleMode && this.focusedItem) {
×
198
            this.combo.select(this.focusedItem.itemID);
×
199
        }
200

201
        this.close();
×
202
    }
203

204
    private handleSpace() {
UNCOV
205
        if (this.isAddItemFocused()) {
×
UNCOV
206
            return;
×
207
        } else {
UNCOV
208
            this.selectItem(this.focusedItem);
×
209
        }
210
    }
211

212
    private isAddItemFocused(): boolean {
UNCOV
213
        return this.focusedItem instanceof IgxComboAddItemComponent;
×
214
    }
215

216
    private focusAddItemButton() {
UNCOV
217
        if (this.combo.isAddButtonVisible()) {
×
218
            this.focusedItem = this.items[this.items.length - 1];
×
219
        }
220
    }
221
}
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

© 2026 Coveralls, Inc