• 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

11.76
/src/color-picker/parts/inputs/inputs.component.ts
1
import { Component, effect, HostBinding, input, OnInit, output, signal, WritableSignal } from '@angular/core';
2
import { FormsModule } from '@angular/forms';
3
import { ThyInputDirective, ThyInputGroup } from 'ngx-tethys/input';
4
import { ThyInputNumber } 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',
13
    templateUrl: './inputs.component.html',
1✔
14
    imports: [ThyInputDirective, FormsModule, ThyEnterDirective, ThyInputNumber, ThyInputGroup]
UNCOV
15
})
×
UNCOV
16
export class ThyColorInputs implements OnInit {
×
UNCOV
17
    @HostBinding('class.thy-color-inputs') className = true;
×
UNCOV
18

×
UNCOV
19
    readonly color = input<ThyColor>();
×
UNCOV
20

×
UNCOV
21
    readonly colorChange = output<ThyColor>();
×
UNCOV
22

×
23
    readonly hex: WritableSignal<string> = signal('');
24

25
    readonly alpha: WritableSignal<number> = signal(100);
26

27
    constructor() {
UNCOV
28
        effect(() => {
×
UNCOV
29
            this.hex.set(this.color()?.toHexString(false).slice(1, 7) || '');
×
UNCOV
30
            this.alpha.set(Math.round(this.color()?.rgba.alpha * 100) || 100);
×
UNCOV
31
        });
×
32
    }
×
33

34
    ngOnInit(): void {}
×
35

36
    onInputChange(event: Event, type: string) {
UNCOV
37
        let newColor;
×
UNCOV
38
        const alpha = this.alpha() / 100;
×
39
        if (type === 'hex') {
×
40
            let finalDisplayValue = this.hex();
UNCOV
41
            if (this.hex().length === 3) {
×
42
                finalDisplayValue = this.hex()
43
                    .split('')
UNCOV
44
                    .map(value => value + value)
×
45
                    .join('');
UNCOV
46
            }
×
47
            finalDisplayValue = `#${finalDisplayValue}`;
48
            if (alpha !== 1) {
1✔
49
                finalDisplayValue += ((1 << 8) | Math.round(alpha * 255)).toString(16).substr(1);
1✔
50
            }
51
            newColor = new ThyColor(finalDisplayValue);
52
        } else {
53
            newColor = new ThyColor().setRgba(this.color().rgba.red, this.color().rgba.green, this.color().rgba.blue, alpha);
54
        }
55
        this.colorChange.emit(newColor);
1✔
56
    }
57
}
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