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

atinc / ngx-tethys / c0ef8457-a839-451f-8b72-80fd73106231

02 Apr 2024 02:27PM UTC coverage: 90.524% (-0.06%) from 90.585%
c0ef8457-a839-451f-8b72-80fd73106231

Pull #3062

circleci

minlovehua
refactor(all): use the transform attribute of @Input() instead of @InputBoolean() and @InputNumber()
Pull Request #3062: refactor(all): use the transform attribute of @input() instead of @InputBoolean() and @InputNumber()

4987 of 6108 branches covered (81.65%)

Branch coverage included in aggregate %.

217 of 223 new or added lines in 82 files covered. (97.31%)

202 existing lines in 53 files now uncovered.

12246 of 12929 relevant lines covered (94.72%)

1055.59 hits per line

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

80.0
/src/cascader/cascader-search-option.component.ts
1
import { NgFor, NgIf } from '@angular/common';
2
import {
3
    ChangeDetectionStrategy,
4
    Component,
5
    EventEmitter,
6
    HostBinding,
7
    HostListener,
8
    Input,
9
    OnInit,
10
    Output,
11
    ViewEncapsulation,
12
    booleanAttribute
13
} from '@angular/core';
1✔
14
import { FormsModule } from '@angular/forms';
15
import { ThyBreadcrumb, ThyBreadcrumbItem } from 'ngx-tethys/breadcrumb';
1!
UNCOV
16
import { ThyCheckbox } from 'ngx-tethys/checkbox';
×
17
import { ThyFlexibleText } from 'ngx-tethys/flexible-text';
18
import { ThyIcon } from 'ngx-tethys/icon';
1✔
19
import { ThyCascaderSearchOption } from './types';
20

21
/**
4✔
22
 * @internal
4✔
23
 */
4✔
24
@Component({
4✔
25
    changeDetection: ChangeDetectionStrategy.OnPush,
4✔
26
    encapsulation: ViewEncapsulation.None,
27
    // eslint-disable-next-line @angular-eslint/component-selector
28
    selector: '[thy-cascader-search-option]',
29
    templateUrl: './cascader-search-option.component.html',
30
    standalone: true,
1!
31
    imports: [NgIf, NgFor, ThyFlexibleText, ThyCheckbox, ThyBreadcrumb, ThyBreadcrumbItem, ThyIcon, FormsModule]
1✔
32
})
1✔
33
export class ThyCascaderSearchOptionComponent implements OnInit {
34
    @Input() option: ThyCascaderSearchOption;
35

UNCOV
36
    @HostBinding('class.multiple')
×
37
    @Input({ transform: booleanAttribute })
38
    multiple = false;
1✔
39

1✔
40
    @Input({ transform: booleanAttribute })
41
    isOnlySelectLeaf = true;
42
    @HostBinding('class') className = 'thy-cascader-search-list-item px-4 d-flex align-items-center cursor-pointer';
43

44
    @HostBinding('class.active')
45
    @Input({ transform: booleanAttribute })
46
    active: boolean = false;
47

48
    @HostListener('click', ['$event'])
49
    public toggleClick($event: Event) {
1✔
50
        if (this.multiple) {
51
            return;
52
        }
53
        this.toggleSelectChange.emit(this.option);
54
    }
55

56
    @Output() toggleSelectChange: EventEmitter<ThyCascaderSearchOption> = new EventEmitter();
57

58
    constructor() {}
59

60
    ngOnInit() {}
61

62
    public clickCheckbox(event: Event) {
63
        // 已选中的在搜索情况下不能取消选择
64
        if (this.active) {
65
            event.preventDefault();
66
            event.stopPropagation();
67
        }
68
    }
69

70
    public toggleOption(value: boolean) {
71
        this.toggleSelectChange.emit(this.option);
72
    }
73
}
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