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

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

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

16.67
/src/typography/bg-color.directive.ts
1
import { Directive, ElementRef, 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({
1✔
10
    selector: '[thyBgColor]',
11
    exportAs: 'thyBgColor',
×
12
    standalone: true
×
13
})
×
14
export class ThyBackgroundColorDirective {
15
    private bgColor: ThyThemeColor | ThyBgColor | string = '';
16

×
17
    private hostRenderer = useHostRenderer();
×
18

×
19
    /**
20
     *  @type ThyThemeColor | ThyBgColor | string
21
     *  @description 背景颜色,支持设置主题色和自定义颜色值,主题色为 `primary`、`success`、`info`、`danger`、`warning`、`dark`、`secondary`、`light`、`lighter`、`bright`、`content`、`white`、`transparent`
×
22
     */
×
23
    @Input() set thyBgColor(value: ThyThemeColor | ThyBgColor | string) {
24
        this.clearBgColor();
25
        this.bgColor = value;
×
26
        this.setBgColor();
27
    }
28

29
    constructor(private elementRef: ElementRef) {}
×
30

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

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