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

atinc / ngx-tethys / e62d3b10-1466-49c3-aabd-707148681fc8

14 Jun 2024 08:24AM UTC coverage: 90.422%. Remained the same
e62d3b10-1466-49c3-aabd-707148681fc8

push

circleci

minlovehua
feat: use the ngx-tethys/util's coerceBooleanProperty instead of booleanAttribute #INFR-12648

5467 of 6692 branches covered (81.69%)

Branch coverage included in aggregate %.

117 of 120 new or added lines in 66 files covered. (97.5%)

183 existing lines in 46 files now uncovered.

13216 of 13970 relevant lines covered (94.6%)

985.91 hits per line

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

95.24
/src/dropdown/dropdown-menu.component.ts
1
import { NgIf, NgTemplateOutlet } from '@angular/common';
2
import {
3
    ChangeDetectionStrategy,
4
    Component,
5
    Directive,
6
    HostBinding,
1✔
7
    Input,
8
    TemplateRef,
9
    ViewChild,
10
    ViewEncapsulation
1✔
11
} from '@angular/core';
12
import { InputCssPixel } from 'ngx-tethys/core';
1✔
13
import { SafeAny } from 'ngx-tethys/types';
14
import { coerceBooleanProperty } from 'ngx-tethys/util';
1✔
15

16
export type ThyDropdownMenuDividerType = 'default' | 'crossing' | '';
17

18
export const THY_DROPDOWN_DEFAULT_WIDTH = '240px';
1✔
19

20
/**
21
 * @private
22
 */
23
@Directive()
24
export class ThyDropdownAbstractMenu {
25
    @HostBinding('class.thy-dropdown-menu') addDropdownMenuClass = true;
26
}
27

1✔
28
/**
UNCOV
29
 * 下拉菜单组件
×
30
 * @name thy-dropdown-menu
31
 * @order 20
32
 */
54✔
33
@Component({
54✔
34
    selector: 'thy-dropdown-menu',
35
    template: `
1✔
36
        <ng-container *ngIf="thyImmediateRender; then content"> </ng-container>
1✔
37
        <ng-template #dropdownMenu>
38
            <div class="thy-dropdown-menu" [style.width]="thyWidth">
39
                <ng-container *ngTemplateOutlet="content"></ng-container>
40
            </div>
41
        </ng-template>
42
        <ng-template #content>
1✔
43
            <ng-content></ng-content>
44
        </ng-template>
45
    `,
46
    encapsulation: ViewEncapsulation.None,
1✔
47
    changeDetection: ChangeDetectionStrategy.OnPush,
48
    host: {
49
        '[class.thy-dropdown-menu]': 'thyImmediateRender',
50
        '[style.width]': "thyImmediateRender ? thyWidth : ''"
51
    },
52
    standalone: true,
53
    imports: [NgIf, NgTemplateOutlet]
54
})
55
export class ThyDropdownMenuComponent {
56
    get template() {
57
        return this.templateRef;
58
    }
59

60
    @ViewChild('dropdownMenu', { static: true }) templateRef!: TemplateRef<SafeAny>;
61

62
    /**
63
     * 设置菜单宽度
64
     * @default 240px
65
     */
66
    @Input()
67
    @InputCssPixel()
68
    thyWidth: number | string = THY_DROPDOWN_DEFAULT_WIDTH;
69

70
    /**
71
     * 是否直接渲染 dropdown-menu 中的元素
72
     * @default false
73
     */
74
    @Input({ transform: coerceBooleanProperty }) thyImmediateRender = false;
75

76
    constructor() {}
77
}
1✔
78

79
/**
6✔
80
 * 下拉菜单分组
81
 * @name thy-dropdown-menu-group
82
 * @order 50
1✔
83
 */
1✔
84
@Component({
85
    selector: 'thy-dropdown-menu-group',
86
    template: `
87
        <div class="dropdown-menu-group-title">{{ title }}</div>
1✔
88
        <ng-content></ng-content>
89
    `,
90
    changeDetection: ChangeDetectionStrategy.OnPush,
91
    host: {
92
        class: 'dropdown-menu-group'
93
    },
94
    standalone: true
95
})
96
export class ThyDropdownMenuGroup {
97
    title: string;
98

99
    /**
100
     * 分组标题
101
     */
102
    @Input()
103
    set thyTitle(value: string) {
104
        this.title = value;
105
    }
106

107
    constructor() {}
1✔
108
}
109

1✔
110
/**
111
 * 下拉菜单分割线
1✔
112
 * @name thy-dropdown-menu-divider
113
 */
114
@Component({
115
    selector: 'thy-dropdown-menu-divider',
116
    template: ` <!-- <div class="dropdown-menu-divider-title">{{ title }}</div> --> `,
117
    host: {
118
        class: 'dropdown-menu-divider'
119
    },
120
    changeDetection: ChangeDetectionStrategy.OnPush,
121
    standalone: true
122
})
123
export class ThyDropdownMenuDivider {
124
    constructor() {}
125
}
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