• 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

14.81
/src/typography/text-color.directive.ts
1
import { Directive, ElementRef, OnInit, effect, inject, input } from '@angular/core';
2
import { isTextColor, isThemeColor, ThyTextColor, ThyThemeColor } from 'ngx-tethys/core';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4

5
/**
6
 * @name thyTextColor
7
 * @order 20
8
 */
9
@Directive({
10
    selector: '[thyTextColor]',
1✔
11
    exportAs: 'thyTextColor'
UNCOV
12
})
×
UNCOV
13
export class ThyTextColorDirective implements OnInit {
×
UNCOV
14
    private elementRef = inject(ElementRef);
×
UNCOV
15

×
UNCOV
16
    private color: ThyThemeColor | ThyTextColor | string = '';
×
UNCOV
17

×
UNCOV
18
    private hostRenderer = useHostRenderer();
×
UNCOV
19

×
UNCOV
20
    /**
×
21
     * @type ThyThemeColor | ThyTextColor | string
22
     * @description 文本颜色,支持设置主题色和自定义颜色值,主题色为 `default`、`primary`、`success`、`info`、`warning`、`danger`、`light`、`secondary`、`muted`、`desc`、`placeholder`
23
     */
24
    readonly thyTextColor = input<ThyThemeColor | ThyTextColor | string>(undefined);
UNCOV
25

×
UNCOV
26
    constructor() {
×
27
        effect(() => {
28
            const color = this.thyTextColor();
UNCOV
29
            this.clearColor();
×
30
            this.color = color;
31
            this.setColor();
32
        });
UNCOV
33
    }
×
UNCOV
34

×
UNCOV
35
    ngOnInit(): void {}
×
36

37
    private setColor() {
38
        if (isThemeColor(this.color) || isTextColor(this.color)) {
1✔
39
            this.hostRenderer.addClass(`text-${this.color}`);
1✔
40
        } else {
41
            this.hostRenderer.setStyle('color', this.color);
42
        }
43
    }
1✔
44

45
    private clearColor() {
46
        this.hostRenderer.setStyle('color', '');
47
        if (isThemeColor(this.color) || isTextColor(this.color)) {
48
            this.hostRenderer.removeClass(`text-${this.color}`);
49
        }
50
    }
51
}
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