source: trip-planner-front/node_modules/@angular/material/esm2015/checkbox/testing/checkbox-harness.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 17.8 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { __awaiter } from "tslib";
9import { coerceBooleanProperty } from '@angular/cdk/coercion';
10import { ComponentHarness, HarnessPredicate, } from '@angular/cdk/testing';
11export class _MatCheckboxHarnessBase extends ComponentHarness {
12 /** Whether the checkbox is checked. */
13 isChecked() {
14 return __awaiter(this, void 0, void 0, function* () {
15 const checked = (yield this._input()).getProperty('checked');
16 return coerceBooleanProperty(yield checked);
17 });
18 }
19 /** Whether the checkbox is in an indeterminate state. */
20 isIndeterminate() {
21 return __awaiter(this, void 0, void 0, function* () {
22 const indeterminate = (yield this._input()).getProperty('indeterminate');
23 return coerceBooleanProperty(yield indeterminate);
24 });
25 }
26 /** Whether the checkbox is disabled. */
27 isDisabled() {
28 return __awaiter(this, void 0, void 0, function* () {
29 const disabled = (yield this._input()).getAttribute('disabled');
30 return coerceBooleanProperty(yield disabled);
31 });
32 }
33 /** Whether the checkbox is required. */
34 isRequired() {
35 return __awaiter(this, void 0, void 0, function* () {
36 const required = (yield this._input()).getProperty('required');
37 return coerceBooleanProperty(yield required);
38 });
39 }
40 /** Whether the checkbox is valid. */
41 isValid() {
42 return __awaiter(this, void 0, void 0, function* () {
43 const invalid = (yield this.host()).hasClass('ng-invalid');
44 return !(yield invalid);
45 });
46 }
47 /** Gets the checkbox's name. */
48 getName() {
49 return __awaiter(this, void 0, void 0, function* () {
50 return (yield this._input()).getAttribute('name');
51 });
52 }
53 /** Gets the checkbox's value. */
54 getValue() {
55 return __awaiter(this, void 0, void 0, function* () {
56 return (yield this._input()).getProperty('value');
57 });
58 }
59 /** Gets the checkbox's aria-label. */
60 getAriaLabel() {
61 return __awaiter(this, void 0, void 0, function* () {
62 return (yield this._input()).getAttribute('aria-label');
63 });
64 }
65 /** Gets the checkbox's aria-labelledby. */
66 getAriaLabelledby() {
67 return __awaiter(this, void 0, void 0, function* () {
68 return (yield this._input()).getAttribute('aria-labelledby');
69 });
70 }
71 /** Gets the checkbox's label text. */
72 getLabelText() {
73 return __awaiter(this, void 0, void 0, function* () {
74 return (yield this._label()).text();
75 });
76 }
77 /** Focuses the checkbox. */
78 focus() {
79 return __awaiter(this, void 0, void 0, function* () {
80 return (yield this._input()).focus();
81 });
82 }
83 /** Blurs the checkbox. */
84 blur() {
85 return __awaiter(this, void 0, void 0, function* () {
86 return (yield this._input()).blur();
87 });
88 }
89 /** Whether the checkbox is focused. */
90 isFocused() {
91 return __awaiter(this, void 0, void 0, function* () {
92 return (yield this._input()).isFocused();
93 });
94 }
95 /**
96 * Puts the checkbox in a checked state by toggling it if it is currently unchecked, or doing
97 * nothing if it is already checked.
98 *
99 * Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
100 * are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
101 * might not have the expected result.
102 */
103 check() {
104 return __awaiter(this, void 0, void 0, function* () {
105 if (!(yield this.isChecked())) {
106 yield this.toggle();
107 }
108 });
109 }
110 /**
111 * Puts the checkbox in an unchecked state by toggling it if it is currently checked, or doing
112 * nothing if it is already unchecked.
113 *
114 * Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
115 * are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
116 * might not have the expected result.
117 */
118 uncheck() {
119 return __awaiter(this, void 0, void 0, function* () {
120 if (yield this.isChecked()) {
121 yield this.toggle();
122 }
123 });
124 }
125}
126/** Harness for interacting with a standard mat-checkbox in tests. */
127export class MatCheckboxHarness extends _MatCheckboxHarnessBase {
128 constructor() {
129 super(...arguments);
130 this._input = this.locatorFor('input');
131 this._label = this.locatorFor('.mat-checkbox-label');
132 this._inputContainer = this.locatorFor('.mat-checkbox-inner-container');
133 }
134 /**
135 * Gets a `HarnessPredicate` that can be used to search for a `MatCheckboxHarness` that meets
136 * certain criteria.
137 * @param options Options for filtering which checkbox instances are considered a match.
138 * @return a `HarnessPredicate` configured with the given options.
139 */
140 static with(options = {}) {
141 return new HarnessPredicate(MatCheckboxHarness, options)
142 .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabelText(), label))
143 // We want to provide a filter option for "name" because the name of the checkbox is
144 // only set on the underlying input. This means that it's not possible for developers
145 // to retrieve the harness of a specific checkbox with name through a CSS selector.
146 .addOption('name', options.name, (harness, name) => __awaiter(this, void 0, void 0, function* () { return (yield harness.getName()) === name; }));
147 }
148 toggle() {
149 return __awaiter(this, void 0, void 0, function* () {
150 return (yield this._inputContainer()).click();
151 });
152 }
153}
154/** The selector for the host element of a `MatCheckbox` instance. */
155MatCheckboxHarness.hostSelector = '.mat-checkbox';
156//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2tib3gtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9jaGVja2JveC90ZXN0aW5nL2NoZWNrYm94LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxxQkFBcUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBQzVELE9BQU8sRUFFTCxnQkFBZ0IsRUFDaEIsZ0JBQWdCLEdBRWpCLE1BQU0sc0JBQXNCLENBQUM7QUFHOUIsTUFBTSxPQUFnQix1QkFBd0IsU0FBUSxnQkFBZ0I7SUFJcEUsdUNBQXVDO0lBQ2pDLFNBQVM7O1lBQ2IsTUFBTSxPQUFPLEdBQUcsQ0FBQyxNQUFNLElBQUksQ0FBQyxNQUF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