• 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

5.26
/projects/igniteui-angular/src/lib/carousel/slide.component.ts
1
import { Component, OnDestroy, Input, HostBinding, Output, EventEmitter, ElementRef, AfterContentChecked, booleanAttribute, Inject } from '@angular/core';
2
import { Subject } from 'rxjs';
3
import { Direction, ICarouselComponentBase, IGX_CAROUSEL_COMPONENT, IgxSlideComponentBase } from './carousel-base';
4

5
/**
6
 * A slide component that usually holds an image and/or a caption text.
7
 * IgxSlideComponent is usually a child component of an IgxCarouselComponent.
8
 *
9
 * ```
10
 * <igx-slide [input bindings] >
11
 *    <ng-content></ng-content>
12
 * </igx-slide>
13
 * ```
14
 *
15
 * @export
16
 */
17
@Component({
18
    selector: 'igx-slide',
19
    templateUrl: 'slide.component.html',
20
    standalone: true
21
})
22
export class IgxSlideComponent implements AfterContentChecked, OnDestroy, IgxSlideComponentBase {
2✔
23
    /**
24
     * Gets/sets the `index` of the slide inside the carousel.
25
     * ```html
26
     * <igx-carousel>
27
     *  <igx-slide index="1"></igx-slide>
28
     * <igx-carousel>
29
     * ```
30
     *
31
     * @memberOf IgxSlideComponent
32
     */
33
    @Input() public index: number;
34

35
    /**
36
     * Gets/sets the target `direction` for the slide.
37
     * ```html
38
     * <igx-carousel>
39
     *  <igx-slide direction="NEXT"></igx-slide>
40
     * <igx-carousel>
41
     * ```
42
     *
43
     * @memberOf IgxSlideComponent
44
     */
45
    @Input() public direction: Direction;
46

47
    @Input()
48
    public total: number;
49

50
    /**
51
     * Returns the `tabIndex` of the slide component.
52
     * ```typescript
53
     * let tabIndex =  this.carousel.tabIndex;
54
     * ```
55
     *
56
     * @memberof IgxSlideComponent
57
     */
58
    @HostBinding('attr.tabindex')
59
    public get tabIndex() {
UNCOV
60
        return this.active && this.carousel.keyboardSupport ? 0 : null;
×
61
    }
62

63
    /**
64
     * @hidden
65
     */
66
    @HostBinding('attr.id')
67
    public id: string;
68

69
    /**
70
     * Returns the `role` of the slide component.
71
     * By default is set to `tabpanel`
72
     *
73
     * @memberof IgxSlideComponent
74
     */
75
    @HostBinding('attr.role')
UNCOV
76
    public tab = 'tabpanel';
×
77

78
    /** @hidden */
79
    @HostBinding('attr.aria-labelledby')
80
    public ariaLabelledBy;
81

82
    /**
83
     * Returns the class of the slide component.
84
     * ```typescript
85
     * let class =  this.slide.cssClass;
86
     * ```
87
     *
88
     * @memberof IgxSlideComponent
89
     */
90
    @HostBinding('class.igx-slide')
UNCOV
91
    public cssClass = 'igx-slide';
×
92

93
    /**
94
     * Gets/sets the `active` state of the slide.
95
     * ```html
96
     * <igx-carousel>
97
     *  <igx-slide [active] ="false"></igx-slide>
98
     * <igx-carousel>
99
     * ```
100
     *
101
     * Two-way data binding.
102
     * ```html
103
     * <igx-carousel>
104
     *  <igx-slide [(active)] ="model.isActive"></igx-slide>
105
     * <igx-carousel>
106
     * ```
107
     *
108
     * @memberof IgxSlideComponent
109
     */
110
    @HostBinding('class.igx-slide--current')
111
    @Input({ transform: booleanAttribute })
112
    public get active(): boolean {
UNCOV
113
        return this._active;
×
114
    }
115

116
    public set active(value) {
UNCOV
117
        this._active = value;
×
UNCOV
118
        this.activeChange.emit(this._active);
×
119
    }
120

121
    @HostBinding('class.igx-slide--previous')
UNCOV
122
    @Input({ transform: booleanAttribute }) public previous = false;
×
123

124
    /**
125
     * @hidden
126
     */
UNCOV
127
    @Output() public activeChange = new EventEmitter<boolean>();
×
128

UNCOV
129
    private _active = false;
×
UNCOV
130
    private _destroy$ = new Subject<boolean>();
×
131

132
    constructor(
UNCOV
133
        private elementRef: ElementRef,
×
UNCOV
134
        @Inject(IGX_CAROUSEL_COMPONENT) private carousel: ICarouselComponentBase
×
135
    ) { }
136

137
    /**
138
     * Returns a reference to the carousel element in the DOM.
139
     * ```typescript
140
     * let nativeElement =  this.slide.nativeElement;
141
     * ```
142
     *
143
     * @memberof IgxSlideComponent
144
     */
145
    public get nativeElement() {
UNCOV
146
        return this.elementRef.nativeElement;
×
147
    }
148

149
    /**
150
     * @hidden
151
     */
152
    public get isDestroyed(): Subject<boolean> {
UNCOV
153
        return this._destroy$;
×
154
    }
155

156
    public ngAfterContentChecked() {
UNCOV
157
        this.id = `panel-${this.index}`;
×
UNCOV
158
        this.ariaLabelledBy = `tab-${this.index}-${this.total}`;
×
159
    }
160

161
    /**
162
     * @hidden
163
     */
164
    public ngOnDestroy() {
UNCOV
165
        this._destroy$.next(true);
×
UNCOV
166
        this._destroy$.complete();
×
167
    }
168
}
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