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

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

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

14.29
/projects/igniteui-angular/src/lib/switch/switch.component.ts
1
import {
2
    Component,
3
    HostBinding,
4
    Input,
5
    AfterViewInit,
6
    booleanAttribute
7
} from '@angular/core';
8
import { ControlValueAccessor } from '@angular/forms';
9
import { IgxRippleDirective } from '../directives/ripple/ripple.directive';
10
import { EditorProvider, EDITOR_PROVIDER } from '../core/edit-provider';
11
import { CheckboxBaseDirective } from '../checkbox/checkbox-base.directive';
12

13
/**
14
 *
15
 * The Switch component is a binary choice selection component.
16
 *
17
 * @igxModule IgxSwitchModule
18
 *
19
 * @igxTheme igx-switch-theme, igx-tooltip-theme
20
 *
21
 * @igxKeywords switch, states, tooltip
22
 *
23
 * @igxGroup Data Entry & Display
24
 * @remarks
25
 *
26
 * The Ignite UI Switch lets the user toggle between on/off or true/false states.
27
 *
28
 * @example
29
 * ```html
30
 * <igx-switch [checked]="true">
31
 *   Simple switch
32
 * </igx-switch>
33
 * ```
34
 */
35
@Component({
36
    providers: [{
37
        provide: EDITOR_PROVIDER,
38
        useExisting: IgxSwitchComponent,
39
        multi: true
40
    }],
41
    selector: 'igx-switch',
42
    templateUrl: 'switch.component.html',
43
    imports: [IgxRippleDirective]
44
})
45
export class IgxSwitchComponent
2✔
46
    extends CheckboxBaseDirective
47
    implements ControlValueAccessor, EditorProvider, AfterViewInit {
48
    /**
49
     * Returns the class of the switch component.
50
     *
51
     * @example
52
     * ```typescript
53
     * let switchClass = this.switch.cssClass;
54
     * ```
55
     */
56
    @HostBinding('class.igx-switch')
UNCOV
57
    public override cssClass = 'igx-switch';
×
58
    /**
59
     * Sets/gets whether the switch is on or off.
60
     * Default value is 'false'.
61
     *
62
     * @example
63
     * ```html
64
     *  <igx-switch [checked]="true"></igx-switch>
65
     * ```
66
     */
67
    @HostBinding('class.igx-switch--checked')
68
    @Input()
69
    public override set checked(value: boolean) {
UNCOV
70
        super.checked = value;
×
71
    }
72
    public override get checked() {
UNCOV
73
        return super.checked;
×
74
    }
75
    /**
76
     * Sets/gets the `disabled` attribute.
77
     * Default value is `false`.
78
     *
79
     * @example
80
     * ```html
81
     * <igx-switch disabled><igx-switch>
82
     * ```
83
     */
84
    @HostBinding('class.igx-switch--disabled')
85
    @Input({ transform: booleanAttribute })
UNCOV
86
    public override disabled = false;
×
87

88
    /**
89
     * Sets/gets whether the switch component is invalid.
90
     * Default value is `false`.
91
     *
92
     * @example
93
     * ```html
94
     * <igx-switch invalid></igx-switch>
95
     * ```
96
     * ```typescript
97
     * let isInvalid = this.switch.invalid;
98
     * ```
99
     */
100
    @HostBinding('class.igx-switch--invalid')
101
    @Input({ transform: booleanAttribute })
UNCOV
102
    public override invalid = false;
×
103

104
    /**
105
     * Sets/gets whether the switch component is on focus.
106
     * Default value is `false`.
107
     *
108
     * @example
109
     * ```typescript
110
     * this.switch.focused = true;
111
     * ```
112
     */
113
    @HostBinding('class.igx-switch--focused')
UNCOV
114
    public override focused = false;
×
115
}
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