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

atinc / ngx-tethys / 2c17752c-a120-4d08-b03c-7ff08eddc062

19 Nov 2024 07:40AM UTC coverage: 90.366%. Remained the same
2c17752c-a120-4d08-b03c-7ff08eddc062

Pull #3258

circleci

minlovehua
refactor: remove useless import #TINFR-1017
Pull Request #3258: refactor: remove useless import #TINFR-1017

5524 of 6762 branches covered (81.69%)

Branch coverage included in aggregate %.

13218 of 13978 relevant lines covered (94.56%)

995.57 hits per line

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

88.24
/src/radio/radio.component.ts
1
import { Component, forwardRef, OnInit, Input, ChangeDetectionStrategy, inject } from '@angular/core';
2
import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
import { ThyFormCheckBaseComponent } from 'ngx-tethys/shared';
4
import { ThyRadioGroup } from './group/radio-group.component';
5
import { coerceBooleanProperty } from '@angular/cdk/coercion';
6
import { NgClass } from '@angular/common';
7

8
/**
9
 * 单选框组件
10
 * @name thy-radio,[thyRadio]
11
 * @order 10
12
 */
13
@Component({
14
    // eslint-disable-next-line @angular-eslint/component-selector
1✔
15
    selector: '[thy-radio],[thyRadio]',
16
    templateUrl: './radio.component.html',
34✔
17
    providers: [
34✔
18
        {
19
            provide: NG_VALUE_ACCESSOR,
20
            useExisting: forwardRef(() => ThyRadio),
32✔
21
            multi: true
32✔
22
        }
23
    ],
24
    host: {
25✔
25
        '[attr.tabindex]': `-1`
14✔
26
    },
27
    changeDetection: ChangeDetectionStrategy.OnPush,
28
    standalone: true,
29
    imports: [NgClass]
3!
30
})
×
31
export class ThyRadio extends ThyFormCheckBaseComponent implements OnInit {
32
    thyRadioGroupComponent = inject(ThyRadioGroup, { optional: true })!;
33

3✔
34
    name: string;
35

36
    /**
1✔
37
     * 当和 thy-radio-group 配合使用时的值,选中后的 NgModel 值
38
     */
39
    @Input() thyValue: string;
40

1✔
41
    set thyChecked(value: boolean) {
42
        this.writeValue(coerceBooleanProperty(value));
43
        this.changeDetectorRef.markForCheck();
44
    }
45

46
    ngOnInit() {
47
        if (this.thyRadioGroupComponent) {
48
            this.thyRadioGroupComponent.addRadio(this);
9✔
49
        }
50
    }
51

52
    change() {
53
        if (this.thyRadioGroupComponent) {
54
            this.thyRadioGroupComponent.updateValue(this.thyValue, true);
55
        } else {
56
            this.updateValue(!this._innerValue);
57
        }
58
    }
59
}
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