• 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/color-picker/parts/inputs/inputs.component.ts
1
import { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';
2
import { FormsModule } from '@angular/forms';
3
import { ThyInputDirective } from 'ngx-tethys/input';
4
import { ThyInputNumberComponent } from 'ngx-tethys/input-number';
5
import { ThyEnterDirective } from 'ngx-tethys/shared';
6
import ThyColor from '../../helpers/color.class';
7

8
/**
9
 * @internal
10
 */
11
@Component({
12
    selector: 'thy-color-inputs',
1✔
13
    templateUrl: './inputs.component.html',
14
    standalone: true,
×
15
    imports: [ThyInputDirective, FormsModule, ThyEnterDirective, ThyInputNumberComponent]
×
16
})
17
export class ThyColorInputsComponent {
18
    @HostBinding('class.thy-color-inputs') className = true;
×
19

×
20
    innerColor: ThyColor;
21

22
    @Input()
×
23
    set color(value: ThyColor) {
24
        this.alpha = Math.round(value.rgba.alpha * 100);
25
        this.innerColor = value;
26
    }
×
27

×
28
    get color() {
×
29
        return this.innerColor;
30
    }
×
31

32
    @Output()
33
    public colorChange = new EventEmitter<ThyColor>(false);
×
34

35
    alpha: number;
×
36

37
    onInputChange(event: Event, type: string) {
1✔
38
        let newColor;
39
        if (type === 'hex') {
40
            if (this.innerColor.displayValue.trim().slice(0, 1) !== '#') {
41
                this.innerColor.displayValue = `#${this.innerColor.displayValue}`;
42
            }
43
            newColor = new ThyColor(this.innerColor.displayValue);
1✔
44
        } else {
45
            newColor = new ThyColor().setRgba(
46
                this.innerColor.rgba.red,
47
                this.innerColor.rgba.green,
48
                this.innerColor.rgba.blue,
49
                this.alpha / 100
50
            );
51
        }
52
        this.colorChange.emit(newColor);
53
    }
54
}
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