• 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

15.63
/src/button/button-group.component.ts
1
import { coerceBooleanProperty } from '@angular/cdk/coercion';
2
import { useHostRenderer } from '@tethys/cdk/dom';
3
import { Component, HostBinding, Input, OnInit, ViewEncapsulation } from '@angular/core';
4

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

7
export type ButtonGroupType = 'outline-primary' | 'outline-default';
8

9
const buttonGroupSizeMap = {
10
    sm: ['btn-group-sm'],
11
    md: ['btn-group-md'],
12
    lg: ['btn-group-lg'],
13
    xs: ['btn-group-xs']
14
};
15

16
/**
1✔
17
 * 按钮分组组件
UNCOV
18
 * @name thy-button-group
×
UNCOV
19
 * @order 30
×
UNCOV
20
 */
×
21
@Component({
22
    selector: 'thy-button-group',
23
    template: '<ng-content></ng-content>',
UNCOV
24
    encapsulation: ViewEncapsulation.None
×
UNCOV
25
})
×
UNCOV
26
export class ThyButtonGroup implements OnInit {
×
27
    private initialized = false;
28

29
    private type: string;
UNCOV
30

×
31
    private size: string;
32

UNCOV
33
    private hostRenderer = useHostRenderer();
×
UNCOV
34

×
UNCOV
35
    /**
×
UNCOV
36
     * 大小
×
37
     * @type xs | sm | md | lg
38
     * @default md
UNCOV
39
     */
×
UNCOV
40
    @Input()
×
41
    set thySize(size: ButtonGroupSize) {
42
        this.size = size;
UNCOV
43
        if (this.initialized) {
×
UNCOV
44
            this.setClasses();
×
UNCOV
45
        }
×
46
    }
UNCOV
47

×
UNCOV
48
    /**
×
49
     * 类型
UNCOV
50
     * @type outline-default | outline-primary
×
51
     * @default outline-default
52
     */
1✔
53
    @Input()
1✔
54
    set thyType(type: ButtonGroupType) {
55
        this.type = type;
56
        if (this.initialized) {
57
            this.setClasses();
58
        }
59
    }
60

61
    /**
1✔
62
     * 是否需要最小宽度,默认按钮最小宽度为80px
63
     * @default false
64
     */
65
    @Input()
66
    set thyClearMinWidth(value: string) {
67
        this.thyClearMinWidthClassName = coerceBooleanProperty(value);
68
    }
69

70
    @HostBinding('class.btn-group') _isButtonGroup = true;
71
    @HostBinding(`class.btn-group-clear-min-width`)
72
    thyClearMinWidthClassName = false;
73

74
    constructor() {}
75

76
    ngOnInit() {
77
        this.setClasses();
78
        this.initialized = true;
79
    }
80

81
    private setClasses() {
82
        let classNames: string[] = [];
83
        if (this.type) {
84
            classNames.push(`btn-group-${this.type}`);
85
        }
86
        if (buttonGroupSizeMap[this.size]) {
87
            classNames.push(buttonGroupSizeMap[this.size]);
88
        }
89
        this.hostRenderer.updateClass(classNames);
90
    }
91
}
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