• 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

1.08
/projects/igniteui-angular/tabs/src/tabs/tabs/tab-header.component.ts
1
import { AfterViewInit, Component, HostBinding, HostListener, NgZone, OnDestroy, inject } from '@angular/core';
2
import { IgxTabHeaderDirective } from '../tab-header.directive';
3
import { IgxTabHeaderBase } from '../tabs.base';
4
import { IgxTabsComponent } from './tabs.component';
5
import { getResizeObserver, ɵIgxDirectionality } from 'igniteui-angular/core';
6

7
@Component({
8
    selector: 'igx-tab-header',
9
    templateUrl: 'tab-header.component.html',
10
    providers: [{ provide: IgxTabHeaderBase, useExisting: IgxTabHeaderComponent }],
11
    standalone: true
12
})
13
export class IgxTabHeaderComponent extends IgxTabHeaderDirective implements AfterViewInit, OnDestroy {
3✔
UNCOV
14
    protected override tabs = inject(IgxTabsComponent);
×
UNCOV
15
    private ngZone = inject(NgZone);
×
UNCOV
16
    private dir = inject(ɵIgxDirectionality);
×
17

18
    /** @hidden @internal */
19
    @HostBinding('class.igx-tabs__header-item--selected')
20
    public get provideCssClassSelected(): boolean {
UNCOV
21
        return this.tab.selected;
×
22
    }
23

24
    /** @hidden @internal */
25
    @HostBinding('class.igx-tabs__header-item--disabled')
26
    public get provideCssClassDisabled(): boolean {
UNCOV
27
        return this.tab.disabled;
×
28
    }
29

30
    /** @hidden @internal */
31
    @HostBinding('class.igx-tabs__header-item')
UNCOV
32
    public cssClass = true;
×
33

34
    private _resizeObserver: ResizeObserver;
35

36
    /** @hidden @internal */
37
    @HostListener('keydown', ['$event'])
38
    public keyDown(event: KeyboardEvent) {
UNCOV
39
        let unsupportedKey = false;
×
UNCOV
40
        const itemsArray = this.tabs.items.toArray();
×
UNCOV
41
        const previousIndex = itemsArray.indexOf(this.tab);
×
UNCOV
42
        let newIndex = previousIndex;
×
UNCOV
43
        const hasDisabledItems = itemsArray.some((item) => item.disabled);
×
44

UNCOV
45
        switch (event.key) {
×
46
            case this.platform.KEYMAP.ARROW_RIGHT:
UNCOV
47
                newIndex = this.getNewSelectionIndex(newIndex, itemsArray, event.key, hasDisabledItems);
×
UNCOV
48
                break;
×
49
            case this.platform.KEYMAP.ARROW_LEFT:
UNCOV
50
                newIndex = this.getNewSelectionIndex(newIndex, itemsArray, event.key, hasDisabledItems);
×
UNCOV
51
                break;
×
52
            case this.platform.KEYMAP.HOME:
UNCOV
53
                event.preventDefault();
×
UNCOV
54
                newIndex = 0;
×
UNCOV
55
                while (itemsArray[newIndex].disabled && newIndex < itemsArray.length) {
×
UNCOV
56
                    newIndex = newIndex === itemsArray.length - 1 ? 0 : newIndex + 1;
×
57
                }
UNCOV
58
                break;
×
59
            case this.platform.KEYMAP.END:
UNCOV
60
                event.preventDefault();
×
UNCOV
61
                newIndex = itemsArray.length - 1;
×
UNCOV
62
                while (hasDisabledItems && itemsArray[newIndex].disabled && newIndex > 0) {
×
UNCOV
63
                    newIndex = newIndex === 0 ? itemsArray.length - 1 : newIndex - 1;
×
64
                }
UNCOV
65
                break;
×
66
            case this.platform.KEYMAP.ENTER:
67
            case this.platform.KEYMAP.SPACE:
UNCOV
68
                event.preventDefault();
×
UNCOV
69
                if (this.tabs.activation === 'manual') {
×
UNCOV
70
                    this.nativeElement.click();
×
71
                }
UNCOV
72
                unsupportedKey = true;
×
UNCOV
73
                break;
×
74
            default:
75
                unsupportedKey = true;
×
76
                break;
×
77
        }
78

UNCOV
79
        if (!unsupportedKey) {
×
UNCOV
80
            itemsArray[newIndex].headerComponent.nativeElement.focus({ preventScroll: true });
×
UNCOV
81
            if (this.tabs.activation === 'auto') {
×
UNCOV
82
                this.tabs.selectedIndex = newIndex;
×
83
            }
84
        }
85
    }
86

87
    /** @hidden @internal */
88
    public ngAfterViewInit(): void {
UNCOV
89
        this.ngZone.runOutsideAngular(() => {
×
UNCOV
90
            if (this.platform.isBrowser) {
×
UNCOV
91
                this._resizeObserver = new (getResizeObserver())(() => {
×
UNCOV
92
                    this.tabs.realignSelectedIndicator();
×
93
                });
UNCOV
94
                this._resizeObserver.observe(this.nativeElement);
×
95
            }
96
        });
97
    }
98

99
    /** @hidden @internal */
100
    public ngOnDestroy(): void {
UNCOV
101
        this.ngZone.runOutsideAngular(() => {
×
UNCOV
102
            this._resizeObserver?.disconnect();
×
103
        });
104
    }
105

106
    private getNewSelectionIndex(newIndex: number, itemsArray: any[], key: string, hasDisabledItems: boolean): number {
UNCOV
107
        if ((key === this.platform.KEYMAP.ARROW_RIGHT && !this.dir.rtl) || (key === this.platform.KEYMAP.ARROW_LEFT && this.dir.rtl)) {
×
UNCOV
108
            newIndex = newIndex === itemsArray.length - 1 ? 0 : newIndex + 1;
×
UNCOV
109
            while (hasDisabledItems && itemsArray[newIndex].disabled && newIndex < itemsArray.length) {
×
UNCOV
110
                newIndex = newIndex === itemsArray.length - 1 ? 0 : newIndex + 1;
×
111
            }
112
        } else {
UNCOV
113
            newIndex = newIndex === 0 ? itemsArray.length - 1 : newIndex - 1;
×
UNCOV
114
            while (hasDisabledItems && itemsArray[newIndex].disabled && newIndex >= 0) {
×
UNCOV
115
                newIndex = newIndex === 0 ? itemsArray.length - 1 : newIndex - 1;
×
116
            }
117
        }
UNCOV
118
        return newIndex;
×
119
    }
120
}
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