• 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

6.67
/projects/igniteui-angular/src/lib/slider/ticks/ticks.component.ts
1
import { Component, Input, TemplateRef, HostBinding, booleanAttribute } from '@angular/core';
2
import { TicksOrientation, TickLabelsOrientation } from '../slider.common';
3
import { NgFor, NgClass, NgTemplateOutlet } from '@angular/common';
4

5
/**
6
 * @hidden
7
 */
8
@Component({
9
    selector: 'igx-ticks',
10
    templateUrl: 'ticks.component.html',
11
    imports: [NgFor, NgClass, NgTemplateOutlet]
12
})
13
export class IgxTicksComponent {
2✔
14
    @Input()
15
    public primaryTicks: number;
16

17
    @Input()
18
    public secondaryTicks: number;
19

20
    @Input({ transform: booleanAttribute })
21
    public primaryTickLabels: boolean;
22

23
    @Input({ transform: booleanAttribute })
24
    public secondaryTickLabels: boolean;
25

26
    @Input()
27
    public ticksOrientation: TicksOrientation;
28

29
    @Input()
30
    public tickLabelsOrientation: TickLabelsOrientation;
31

32
    @Input()
33
    public maxValue: number;
34

35
    @Input()
36
    public minValue: number;
37

38
    @Input({ transform: booleanAttribute })
39
    public labelsViewEnabled: boolean;
40

41
    @Input()
42
    public labels: Array<number | string | boolean | null | undefined>;
43

44
    @Input()
45
    public tickLabelTemplateRef: TemplateRef<any>;
46

47
    /**
48
     * @hidden
49
     */
50
    @HostBinding('class.igx-slider__ticks')
UNCOV
51
    public ticksClass = true;
×
52

53
    /**
54
     * @hidden
55
     */
56
    @HostBinding('class.igx-slider__ticks--top')
57
    public get ticksTopClass() {
UNCOV
58
        return this.ticksOrientation === TicksOrientation.Top;
×
59
    }
60

61
    /**
62
     * @hidden
63
     */
64
    @HostBinding('class.igx-slider__ticks--tall')
65
    public get hasPrimaryClass() {
UNCOV
66
        return this.primaryTicks > 0;
×
67
    }
68

69
    /**
70
     * @hidden
71
     */
72
    @HostBinding('class.igx-slider__tick-labels--top-bottom')
73
    public get labelsTopToBottomClass() {
UNCOV
74
        return this.tickLabelsOrientation === TickLabelsOrientation.TopToBottom;
×
75
    }
76

77
    /**
78
     * @hidden
79
     */
80
    @HostBinding('class.igx-slider__tick-labels--bottom-top')
81
    public get labelsBottomToTopClass() {
UNCOV
82
        return this.tickLabelsOrientation === TickLabelsOrientation.BottomToTop;
×
83
    }
84

85
    /**
86
     * Returns the template context corresponding to
87
     * {@link IgxTickLabelTemplateDirective}
88
     *
89
     * ```typescript
90
     * return {
91
     *  $implicit //returns the value per each tick label.
92
     *  isPrimery //returns if the tick is primary.
93
     *  labels // returns the {@link labels} collection.
94
     *  index // returns the index per each tick of the whole sequence.
95
     * }
96
     * ```
97
     *
98
     * @param idx the index per each tick label.
99
     */
100
    public context(idx: number): any {
UNCOV
101
        return {
×
102
            $implicit: this.tickLabel(idx),
103
            isPrimary: this.isPrimary(idx),
104
            labels: this.labels,
105
            index: idx
106
        };
107
    }
108

109
    /**
110
     * @hidden
111
     */
112
    public get ticksLength() {
UNCOV
113
        return this.primaryTicks > 0 ?
×
114
            ((this.primaryTicks - 1) * this.secondaryTicks) + this.primaryTicks :
115
            this.secondaryTicks > 0 ? this.secondaryTicks : 0;
×
116
    }
117

118
    public hiddenTickLabels(idx: number) {
UNCOV
119
        return this.isPrimary(idx) ? this.primaryTickLabels : this.secondaryTickLabels;
×
120
    }
121

122
    /**
123
     * @hidden
124
     */
125
    public isPrimary(idx: number) {
UNCOV
126
        return this.primaryTicks <= 0 ? false :
×
127
            idx % (this.secondaryTicks + 1) === 0;
128
    }
129

130
    /**
131
     * @hidden
132
     */
133
    public tickLabel(idx: number) {
UNCOV
134
        if (this.labelsViewEnabled) {
×
UNCOV
135
            return this.labels[idx];
×
136
        }
137

UNCOV
138
        const labelStep = (Math.max(this.minValue, this.maxValue) - Math.min(this.minValue, this.maxValue)) / (this.ticksLength - 1);
×
UNCOV
139
        const labelVal = labelStep * idx;
×
140

UNCOV
141
        return (this.minValue + labelVal).toFixed(2);
×
142
    }
143
}
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