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

atinc / ngx-tethys / 8a6ba229-c82f-4a21-a1ed-95461f2ad66c

04 Sep 2023 08:37AM UTC coverage: 90.196% (-0.004%) from 90.2%
8a6ba229-c82f-4a21-a1ed-95461f2ad66c

Pull #2829

circleci

cmm-va
fix: delete f
Pull Request #2829: fix: add tabIndex

5164 of 6386 branches covered (0.0%)

Branch coverage included in aggregate %.

78 of 78 new or added lines in 26 files covered. (100.0%)

13024 of 13779 relevant lines covered (94.52%)

971.69 hits per line

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

84.21
/src/radio/radio.component.ts
1
import { Component, forwardRef, OnInit, Input, Optional, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
2
import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
import { ThyTranslate } from 'ngx-tethys/core';
4
import { ThyFormCheckBaseComponent } from 'ngx-tethys/shared';
5
import { ThyRadioGroupComponent } from './group/radio-group.component';
6
import { coerceBooleanProperty } from 'ngx-tethys/util';
7
import { NgClass, NgIf } from '@angular/common';
8

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

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

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

1✔
45
    constructor(
46
        public thyTranslate: ThyTranslate,
47
        @Optional() public thyRadioGroupComponent: ThyRadioGroupComponent,
48
        changeDetectorRef: ChangeDetectorRef
1✔
49
    ) {
50
        super(thyTranslate, changeDetectorRef);
51
    }
52

53
    ngOnInit() {
54
        if (this.thyRadioGroupComponent) {
55
            this.thyRadioGroupComponent.addRadio(this);
56
        }
×
57
    }
58

59
    change() {
60
        if (this.thyRadioGroupComponent) {
61
            this.thyRadioGroupComponent.updateValue(this.thyValue, true);
62
        } else {
63
            this.updateValue(!this._innerValue);
64
        }
65
    }
66
}
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