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

atinc / ngx-tethys / #55

30 Jul 2025 07:08AM UTC coverage: 9.866% (-80.4%) from 90.297%
#55

push

why520crazy
feat(empty): add setMessage for update display text #TINFR-2616

92 of 6794 branches covered (1.35%)

Branch coverage included in aggregate %.

2014 of 14552 relevant lines covered (13.84%)

6.15 hits per line

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

20.0
/src/progress/progress-strip.component.ts
1
import {
2
    Component,
3
    InjectionToken,
4
    computed,
5
    TemplateRef,
6
    ViewEncapsulation,
7
    numberAttribute,
1✔
8
    inject,
9
    input,
10
    effect,
11
    Signal
1✔
12
} from '@angular/core';
13
import { useHostRenderer } from '@tethys/cdk/dom';
×
14
import { ThyProgressType } from './interfaces';
×
15
import { NgStyle } from '@angular/common';
×
16

×
17
export interface ThyParentProgress {
×
18
    readonly max: Signal<number>;
19
    readonly bars: Signal<readonly ThyProgressStrip[]>;
20
}
×
21
export const THY_PROGRESS_COMPONENT = new InjectionToken<ThyParentProgress>('THY_PROGRESS_COMPONENT');
×
22

×
23
/**
×
24
 * @private
×
25
 */
26
@Component({
×
27
    selector: 'thy-progress-bar',
28
    templateUrl: './progress-strip.component.html',
×
29
    encapsulation: ViewEncapsulation.None,
×
30
    imports: [NgStyle],
×
31
    host: {
32
        class: 'progress-bar',
33
        '[style.width.%]': 'percent()'
1✔
34
    }
1✔
35
})
36
export class ThyProgressStrip {
37
    private progress = inject(THY_PROGRESS_COMPONENT);
38

39
    private hostRenderer = useHostRenderer();
40

41
    readonly thyTips = input<string | TemplateRef<HTMLElement>>(undefined);
1✔
42

43
    readonly thyType = input<ThyProgressType>();
44

45
    readonly thyValue = input(0, {
46
        transform: numberAttribute
47
    });
48

49
    readonly thyColor = input<string>();
50

51
    protected readonly percent = computed(() => {
52
        const value = this.thyValue();
53
        if (!value && value !== 0) {
54
            return 0;
55
        }
56
        return +((value / this.progress.max()) * 100).toFixed(2);
57
    });
58

59
    constructor() {
60
        effect(() => {
61
            const type = this.thyType();
62
            this.hostRenderer.updateClass(type ? [`progress-bar-${type}`] : []);
63
        });
64
    }
65
}
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