• 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

28.57
/projects/igniteui-angular/src/lib/navbar/navbar.component.ts
1
import { NgIf } from '@angular/common';
2
import {
3
    Component,
4
    EventEmitter,
5
    HostBinding,
6
    Input,
7
    Output,
8
    Directive,
9
    ContentChild,
10
    booleanAttribute
11
} from '@angular/core';
12

13
import { IgxIconComponent } from '../icon/icon.component';
14

15
/**
16
 * IgxActionIcon is a container for the action nav icon of the IgxNavbar.
17
 */
18
@Directive({
19
    selector: 'igx-navbar-action,[igxNavbarAction]',
20
    standalone: true
21
})
22
export class IgxNavbarActionDirective { }
2✔
23

24
@Directive({
25
    selector: 'igx-navbar-title,[igxNavbarTitle]',
26
    standalone: true
27
})
28
export class IgxNavbarTitleDirective { }
2✔
29

30
let NEXT_ID = 0;
2✔
31
/**
32
 * **Ignite UI for Angular Navbar** -
33
 * [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/navbar.html)
34
 *
35
 * The Ignite UI Navbar is most commonly used to provide an app header with a hamburger menu and navigation
36
 * state such as a "Go Back" button. It also supports other actions represented by icons.
37
 *
38
 * Example:
39
 * ```html
40
 * <igx-navbar title="Sample App" actionButtonIcon="menu">
41
 *   <igx-icon>search</igx-icon>
42
 *   <igx-icon>favorite</igx-icon>
43
 *   <igx-icon>more_vert</igx-icon>
44
 * </igx-navbar>
45
 * ```
46
 */
47

48
@Component({
49
    selector: 'igx-navbar',
50
    templateUrl: 'navbar.component.html',
51
    styles: [`
52
        :host {
53
            display: block;
54
            width: 100%;
55
        }
56
    `
57
    ],
58
    imports: [NgIf, IgxIconComponent]
59
})
60

61
export class IgxNavbarComponent {
2✔
62
    /**
63
     * Sets the value of the `id` attribute. If not provided it will be automatically generated.
64
     * ```html
65
     * <igx-navbar [id]="'igx-navbar-12'" title="Sample App" actionButtonIcon="menu">
66
     * ```
67
     */
68
    @HostBinding('attr.id')
69
    @Input()
UNCOV
70
    public id = `igx-navbar-${NEXT_ID++}`;
×
71

72
    /**
73
     * Sets the icon of the `IgxNavbarComponent`.
74
     * ```html
75
     * <igx-navbar [title]="currentView" actionButtonIcon="arrow_back"></igx-navbar>
76
     * ```
77
     */
78
    @Input() public actionButtonIcon: string;
79

80
    /**
81
     * Sets the title of the `IgxNavbarComponent`.
82
     * ```html
83
     * <igx-navbar title="Sample App" actionButtonIcon="menu">
84
     * ```
85
     */
86
    @Input() public title: string;
87

88
    /**
89
     * The event that will be thrown when the action is executed,
90
     * provides reference to the `IgxNavbar` component as argument
91
     * ```typescript
92
     * public actionExc(event){
93
     *     alert("Action Execute!");
94
     * }
95
     *  //..
96
     * ```
97
     * ```html
98
     * <igx-navbar (action)="actionExc($event)" title="Sample App" actionButtonIcon="menu">
99
     * ```
100
     */
UNCOV
101
    @Output() public action = new EventEmitter<IgxNavbarComponent>();
×
102

103
    /**
104
     * Sets the titleId of the `IgxNavbarComponent`. If not set it will be automatically generated.
105
     * ```html
106
     * <igx-navbar [titleId]="'igx-navbar-7'" title="Sample App" actionButtonIcon="menu">
107
     * ```
108
     */
109
    @Input()
UNCOV
110
    public titleId = `igx-navbar-title-${NEXT_ID++}`;
×
111

112
    /**
113
     * @hidden
114
     */
115
    @ContentChild(IgxNavbarActionDirective, { read: IgxNavbarActionDirective })
116
    protected actionIconTemplate: IgxNavbarActionDirective;
117

118
    /**
119
     * @hidden
120
     */
121
    @ContentChild(IgxNavbarTitleDirective, { read: IgxNavbarTitleDirective })
122
    protected titleContent: IgxNavbarTitleDirective;
123

UNCOV
124
    private isVisible = true;
×
125

126
    /**
127
     * Sets whether the action button of the `IgxNavbarComponent` is visible.
128
     * ```html
129
     * <igx-navbar [title]="currentView" [isActionButtonVisible]="'false'"></igx-navbar>
130
     * ```
131
     */
132
    public set isActionButtonVisible(value: boolean) {
UNCOV
133
        this.isVisible = value;
×
134
    }
135

136
    /**
137
     * Returns whether the `IgxNavbarComponent` action button is visible, true/false.
138
     * ```typescript
139
     *  @ViewChild("MyChild")
140
     * public navBar: IgxNavbarComponent;
141
     * ngAfterViewInit(){
142
     *     let actionButtonVisibile = this.navBar.isActionButtonVisible;
143
     * }
144
     * ```
145
     */
146
    @Input({ transform: booleanAttribute })
147
    public get isActionButtonVisible(): boolean {
UNCOV
148
        if (this.actionIconTemplate || !this.actionButtonIcon) {
×
UNCOV
149
            return false;
×
150
        }
UNCOV
151
        return this.isVisible;
×
152
    }
153

154
    public get isTitleContentVisible(): boolean {
UNCOV
155
        return this.titleContent ? true : false;
×
156
    }
157

158
    /**
159
     * @hidden
160
     */
161
    public _triggerAction() {
UNCOV
162
        this.action.emit(this);
×
163
    }
164
}
165

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