• 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/bg-color.directive.ts
1
import { Directive, ElementRef, effect, inject, input } from '@angular/core';
2
import { isBgColor, isThemeColor, ThyBgColor, ThyThemeColor } from 'ngx-tethys/core';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4

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

×
UNCOV
16
    private bgColor: ThyThemeColor | ThyBgColor | string = '';
×
UNCOV
17

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

×
UNCOV
20
    /**
×
21
     *  @type ThyThemeColor | ThyBgColor | string
22
     *  @description 背景颜色,支持设置主题色和自定义颜色值,主题色为 `primary`、`success`、`info`、`danger`、`warning`、`dark`、`secondary`、`light`、`lighter`、`bright`、`content`、`white`、`transparent`
23
     */
UNCOV
24
    readonly thyBgColor = input<ThyThemeColor | ThyBgColor | string>(undefined);
×
UNCOV
25

×
26
    constructor() {
27
        effect(() => {
UNCOV
28
            const bgColor = this.thyBgColor();
×
29
            this.clearBgColor();
30
            this.bgColor = bgColor;
31
            this.setBgColor();
UNCOV
32
        });
×
UNCOV
33
    }
×
UNCOV
34

×
35
    private setBgColor() {
36
        if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {
37
            this.hostRenderer.addClass(`bg-${this.bgColor}`);
1✔
38
        } else {
1✔
39
            this.hostRenderer.setStyle('background-color', this.bgColor);
40
        }
41
    }
42

1✔
43
    private clearBgColor() {
44
        this.hostRenderer.setStyle('background-color', '');
45
        if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {
46
            this.hostRenderer.removeClass(`bg-${this.bgColor}`);
47
        }
48
    }
49
}
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