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

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

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

37.04
/src/strength/strength.component.ts
1
import { ThyTranslate } from 'ngx-tethys/core';
2

3
import { Component, forwardRef, HostBinding, Input, OnInit, inject, Signal } from '@angular/core';
4
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
5
import { injectLocale, ThyStrengthLocale } from 'ngx-tethys/i18n';
6

7
enum ThyStrengthEnum {
8
    highest = 4,
1✔
9
    high = 3,
1✔
10
    average = 2,
1✔
11
    low = 1
1✔
12
}
1✔
13

2✔
14
/**
15
 * 程度展示组件
16
 * @name thy-strength
17
 * @order 10
18
 */
19
@Component({
1✔
20
    selector: 'thy-strength',
UNCOV
21
    templateUrl: 'strength.component.html',
×
UNCOV
22
    providers: [
×
UNCOV
23
        {
×
UNCOV
24
            provide: NG_VALUE_ACCESSOR,
×
25
            useExisting: forwardRef(() => ThyStrength),
26
            multi: true
27
        }
28
    ]
29
})
30
export class ThyStrength implements OnInit, ControlValueAccessor {
31
    translate = inject(ThyTranslate);
32

33
    @HostBinding('class.password-strength-container') styleClass = true;
34

35
    strengthTitle: string;
36

37
    strength: ThyStrengthEnum;
38

39
    locale: Signal<ThyStrengthLocale> = injectLocale('strength');
40

41
    strengthMap = {
UNCOV
42
        [ThyStrengthEnum.highest]: {
×
UNCOV
43
            level: 'highest',
×
44
            text: this.locale().highest
45
        },
UNCOV
46
        [ThyStrengthEnum.high]: {
×
47
            level: 'high',
48
            text: this.locale().high
UNCOV
49
        },
×
50
        [ThyStrengthEnum.average]: {
51
            level: 'average',
UNCOV
52
            text: this.locale().medium
×
53
        },
54
        [ThyStrengthEnum.low]: {
UNCOV
55
            level: 'low',
×
56
            text: this.locale().low
57
        }
UNCOV
58
    };
×
59

60
    /**
61
     * 组件标题,描述程度所指类型
UNCOV
62
     */
×
UNCOV
63
    @Input()
×
UNCOV
64
    set titleKey(value: string) {
×
65
        this.strengthTitle = this.translate.instant(value);
66
    }
UNCOV
67

×
68
    /**
69
     * 程度最高值文本
UNCOV
70
     * @default 最高
×
71
     */
72
    @Input()
1✔
73
    set highestKey(value: string) {
74
        this.strengthMap[ThyStrengthEnum.highest].text = this.translate.instant(value);
75
    }
76

77
    /**
78
     * 程度为高值时展示的文本
79
     * @default 高
80
     */
81
    @Input()
1✔
82
    set highKey(value: string) {
83
        this.strengthMap[ThyStrengthEnum.high].text = this.translate.instant(value);
84
    }
85

86
    /**
87
     * 程度为中值时展示的文本
UNCOV
88
     * @default 中
×
89
     */
90
    @Input()
91
    set averageKey(value: string) {
92
        this.strengthMap[ThyStrengthEnum.average].text = this.translate.instant(value);
93
    }
94

95
    /**
96
     * 程度为低值时展示的文本
97
     * @default 低
98
     */
99
    @Input()
100
    set lowKey(value: string) {
101
        this.strengthMap[ThyStrengthEnum.low].text = this.translate.instant(value);
102
    }
103

104
    private _onChange = Function.prototype;
105

106
    private _onTouched = Function.prototype;
107

108
    ngOnInit() {}
109

110
    writeValue(value: ThyStrengthEnum) {
111
        this.strength = value;
112
        this._onChange(value);
113
        this._onTouched();
114
    }
115

116
    registerOnChange(fn: (value: any) => any): void {
117
        this._onChange = fn;
118
    }
119

120
    registerOnTouched(fn: () => any): void {
121
        this._onTouched = fn;
122
    }
123
}
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