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

atinc / ngx-tethys / cd64db52-e563-41a3-85f3-a0adb87ce135

30 Oct 2024 08:03AM UTC coverage: 90.402% (-0.04%) from 90.438%
cd64db52-e563-41a3-85f3-a0adb87ce135

push

circleci

web-flow
refactor: refactor constructor to the inject function (#3222)

5503 of 6730 branches covered (81.77%)

Branch coverage included in aggregate %.

422 of 429 new or added lines in 170 files covered. (98.37%)

344 existing lines in 81 files now uncovered.

13184 of 13941 relevant lines covered (94.57%)

997.19 hits per line

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

86.96
/src/progress/progress-strip.component.ts
1
import { Component, HostBinding, InjectionToken, Input, TemplateRef, ViewEncapsulation, numberAttribute, inject } from '@angular/core';
2
import { useHostRenderer } from '@tethys/cdk/dom';
3
import { ThyProgressType } from './interfaces';
4
import { NgStyle } from '@angular/common';
5

6
export interface ThyParentProgress {
1✔
7
    max: number;
8
    bars: ThyProgressStrip[];
9
}
10
export const THY_PROGRESS_COMPONENT = new InjectionToken<ThyParentProgress>('THY_PROGRESS_COMPONENT');
1✔
11

12
/**
27✔
13
 * @private
27✔
14
 */
27✔
15
@Component({
27✔
16
    selector: 'thy-progress-bar',
17
    templateUrl: './progress-strip.component.html',
18
    encapsulation: ViewEncapsulation.None,
28✔
19
    standalone: true,
20
    imports: [NgStyle]
21
})
31!
UNCOV
22
export class ThyProgressStrip {
×
23
    private progress = inject(THY_PROGRESS_COMPONENT);
24

31✔
25
    private value: number;
31✔
26

27
    private hostRenderer = useHostRenderer();
28

21✔
29
    color: string;
30

31
    @HostBinding(`class.progress-bar`) isProgressBar = true;
36✔
32

33
    @HostBinding('style.width.%') percent = 0;
1✔
34

35
    @Input() thyTips: string | TemplateRef<HTMLElement>;
36

37
    @Input() set thyType(type: ThyProgressType) {
38
        this.hostRenderer.updateClass(type ? [`progress-bar-${type}`] : []);
39
    }
40

41
    @Input({ transform: numberAttribute })
42
    set thyValue(value: number) {
1✔
43
        if (!value && value !== 0) {
44
            return;
45
        }
46
        this.value = value;
47
        this.recalculatePercentage();
48
    }
49

50
    @Input() set thyColor(color: string) {
51
        this.color = color || '';
52
    }
53

54
    recalculatePercentage(): void {
55
        this.percent = +((this.value / this.progress.max) * 100).toFixed(2);
56
    }
57
}
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