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

atinc / ngx-tethys / 0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

04 Sep 2023 08:40AM UTC coverage: 15.616% (-74.6%) from 90.2%
0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

Pull #2829

circleci

cmm-va
fix: add test
Pull Request #2829: fix: add tabIndex

300 of 6386 branches covered (0.0%)

Branch coverage included in aggregate %.

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

2849 of 13779 relevant lines covered (20.68%)

83.41 hits per line

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

80.95
/src/input/input.directive.ts
1
import { Directive, ElementRef, HostBinding, Input, OnInit, Optional, Renderer2, Self } from '@angular/core';
2
import { NgControl } from '@angular/forms';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4

5
export type ThyInputSize = 'xs' | 'sm' | 'md' | 'lg' | '';
1✔
6

7
const inputGroupSizeMap = {
8
    xs: ['form-control-xs'],
9
    sm: ['form-control-sm'],
10
    md: ['form-control-md'],
11
    lg: ['form-control-lg']
12
};
13

14
/**
15
 * 输入框指令
16
 * @name thyInput
1✔
17
 * @order 10
18
 */
20!
19
@Directive({
20✔
20
    selector: 'input[thyInput], select[thyInput], textarea[thyInput]',
21
    exportAs: 'thyInput',
22
    standalone: true
×
23
})
24
export class ThyInputDirective implements OnInit {
25
    @HostBinding('class.form-control') isFormControl = true;
26

×
27
    private initialized = false;
28

29
    private hostRenderer = useHostRenderer();
×
30

31
    /**
32
     * 输入框大小
20✔
33
     * @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
20✔
34
     * @default default
20✔
35
     */
20✔
36
    @Input()
20✔
37
    set thySize(size: ThyInputSize) {
20✔
38
        if (size && inputGroupSizeMap[size]) {
39
            this.hostRenderer.updateClass(inputGroupSizeMap[size]);
40
        } else {
20✔
41
            this.hostRenderer.updateClass([]);
42
        }
1✔
43
    }
44

45
    get ngControl() {
46
        return this.control;
47
    }
1✔
48

49
    get nativeElement(): HTMLInputElement {
50
        return this.elementRef.nativeElement;
51
    }
52

1✔
53
    constructor(private elementRef: ElementRef, private render: Renderer2, @Optional() @Self() private control: NgControl) {}
54

55
    ngOnInit() {
56
        this.initialized = true;
57
    }
58
}
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

© 2026 Coveralls, Inc