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

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

initial commit

  • Property mode set to 100644
File size: 15.4 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 { HarnessPredicate, parallel } from '@angular/cdk/testing';
10import { MatFormFieldControlHarness } from '@angular/material/form-field/testing/control';
11/** Harness for interacting with a standard Material inputs in tests. */
12export class MatInputHarness extends MatFormFieldControlHarness {
13 /**
14 * Gets a `HarnessPredicate` that can be used to search for a `MatInputHarness` that meets
15 * certain criteria.
16 * @param options Options for filtering which input instances are considered a match.
17 * @return a `HarnessPredicate` configured with the given options.
18 */
19 static with(options = {}) {
20 return new HarnessPredicate(MatInputHarness, options)
21 .addOption('value', options.value, (harness, value) => {
22 return HarnessPredicate.stringMatches(harness.getValue(), value);
23 })
24 .addOption('placeholder', options.placeholder, (harness, placeholder) => {
25 return HarnessPredicate.stringMatches(harness.getPlaceholder(), placeholder);
26 });
27 }
28 /** Whether the input is disabled. */
29 isDisabled() {
30 return __awaiter(this, void 0, void 0, function* () {
31 return (yield this.host()).getProperty('disabled');
32 });
33 }
34 /** Whether the input is required. */
35 isRequired() {
36 return __awaiter(this, void 0, void 0, function* () {
37 return (yield this.host()).getProperty('required');
38 });
39 }
40 /** Whether the input is readonly. */
41 isReadonly() {
42 return __awaiter(this, void 0, void 0, function* () {
43 return (yield this.host()).getProperty('readOnly');
44 });
45 }
46 /** Gets the value of the input. */
47 getValue() {
48 return __awaiter(this, void 0, void 0, function* () {
49 // The "value" property of the native input is never undefined.
50 return (yield (yield this.host()).getProperty('value'));
51 });
52 }
53 /** Gets the name of the input. */
54 getName() {
55 return __awaiter(this, void 0, void 0, function* () {
56 // The "name" property of the native input is never undefined.
57 return (yield (yield this.host()).getProperty('name'));
58 });
59 }
60 /**
61 * Gets the type of the input. Returns "textarea" if the input is
62 * a textarea.
63 */
64 getType() {
65 return __awaiter(this, void 0, void 0, function* () {
66 // The "type" property of the native input is never undefined.
67 return (yield (yield this.host()).getProperty('type'));
68 });
69 }
70 /** Gets the placeholder of the input. */
71 getPlaceholder() {
72 return __awaiter(this, void 0, void 0, function* () {
73 const host = yield this.host();
74 const [nativePlaceholder, fallback] = yield parallel(() => [
75 host.getProperty('placeholder'),
76 host.getAttribute('data-placeholder')
77 ]);
78 return nativePlaceholder || fallback || '';
79 });
80 }
81 /** Gets the id of the input. */
82 getId() {
83 return __awaiter(this, void 0, void 0, function* () {
84 // The input directive always assigns a unique id to the input in
85 // case no id has been explicitly specified.
86 return (yield (yield this.host()).getProperty('id'));
87 });
88 }
89 /**
90 * Focuses the input and returns a promise that indicates when the
91 * action is complete.
92 */
93 focus() {
94 return __awaiter(this, void 0, void 0, function* () {
95 return (yield this.host()).focus();
96 });
97 }
98 /**
99 * Blurs the input and returns a promise that indicates when the
100 * action is complete.
101 */
102 blur() {
103 return __awaiter(this, void 0, void 0, function* () {
104 return (yield this.host()).blur();
105 });
106 }
107 /** Whether the input is focused. */
108 isFocused() {
109 return __awaiter(this, void 0, void 0, function* () {
110 return (yield this.host()).isFocused();
111 });
112 }
113 /**
114 * Sets the value of the input. The value will be set by simulating
115 * keypresses that correspond to the given value.
116 */
117 setValue(newValue) {
118 return __awaiter(this, void 0, void 0, function* () {
119 const inputEl = yield this.host();
120 yield inputEl.clear();
121 // We don't want to send keys for the value if the value is an empty
122 // string in order to clear the value. Sending keys with an empty string
123 // still results in unnecessary focus events.
124 if (newValue) {
125 yield inputEl.sendKeys(newValue);
126 }
127 // Some input types won't respond to key presses (e.g. `color`) so to be sure that the
128 // value is set, we also set the property after the keyboard sequence. Note that we don't
129 // want to do it before, because it can cause the value to be entered twice.
130 yield inputEl.setInputValue(newValue);
131 });
132 }
133}
134// TODO: We do not want to handle `select` elements with `matNativeControl` because
135// not all methods of this harness work reasonably for native select elements.
136// For more details. See: https://github.com/angular/components/pull/18221.
137MatInputHarness.hostSelector = '[matInput], input[matNativeControl], textarea[matNativeControl]';
138//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQtaGFybmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9pbnB1dC90ZXN0aW5nL2lucHV0LWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxnQkFBZ0IsRUFBRSxRQUFRLEVBQUMsTUFBTSxzQkFBc0IsQ0FBQztBQUNoRSxPQUFPLEVBQUMsMEJBQTBCLEVBQUMsTUFBTSw4Q0FBOEMsQ0FBQztBQUd4Rix3RUFBd0U7QUFDeEUsTUFBTSxPQUFPLGVBQWdCLFNBQVEsMEJBQTBCO0lBTTdEOzs7OztPQUtHO0lBQ0gsTUFBTSxDQUFDLElBQUksQ0FBQyxVQUErQixFQUFFO1FBQzNDLE9BQU8sSUFBSSxnQkFBZ0IsQ0FBQyxlQUFlLEVBQUUsT0FBTyxDQUFDO2FBQ2hELFNBQVMsQ0FBQyxPQUFPLEVBQUUsT0FBTyxDQUFDLEtBQUssRUFBRSxDQUFDLE9BQU8sRUFBRSxLQUFLLEVBQUUsRUFBRTtZQUNwRCxPQUFPLGdCQUFnQixDQUFDLGFBQWEsQ0FBQyxPQUFPLENBQUMsUUFBUSxFQUFFLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFDbkUsQ0FBQyxDQUFDO2FBQ0QsU0FBUyxDQUFDLGFBQWEsRUFBRSxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUMsT0FBTyxFQUFFLFdBQVcsRUFBRSxFQUFFO1lBQ3RFLE9BQU8sZ0JBQWdCLENBQUMsYUFBYSxDQUFDL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