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

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

initial commit

  • Property mode set to 100644
File size: 15.9 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';
11import { MatOptgroupHarness, MatOptionHarness } from '@angular/material/core/testing';
12export class _MatAutocompleteHarnessBase extends ComponentHarness {
13 constructor() {
14 super(...arguments);
15 this._documentRootLocator = this.documentRootLocatorFactory();
16 }
17 /** Gets the value of the autocomplete input. */
18 getValue() {
19 return __awaiter(this, void 0, void 0, function* () {
20 return (yield this.host()).getProperty('value');
21 });
22 }
23 /** Whether the autocomplete input is disabled. */
24 isDisabled() {
25 return __awaiter(this, void 0, void 0, function* () {
26 const disabled = (yield this.host()).getAttribute('disabled');
27 return coerceBooleanProperty(yield disabled);
28 });
29 }
30 /** Focuses the autocomplete input. */
31 focus() {
32 return __awaiter(this, void 0, void 0, function* () {
33 return (yield this.host()).focus();
34 });
35 }
36 /** Blurs the autocomplete input. */
37 blur() {
38 return __awaiter(this, void 0, void 0, function* () {
39 return (yield this.host()).blur();
40 });
41 }
42 /** Whether the autocomplete input is focused. */
43 isFocused() {
44 return __awaiter(this, void 0, void 0, function* () {
45 return (yield this.host()).isFocused();
46 });
47 }
48 /** Enters text into the autocomplete. */
49 enterText(value) {
50 return __awaiter(this, void 0, void 0, function* () {
51 return (yield this.host()).sendKeys(value);
52 });
53 }
54 /** Gets the options inside the autocomplete panel. */
55 getOptions(filters) {
56 return __awaiter(this, void 0, void 0, function* () {
57 return this._documentRootLocator.locatorForAll(this._optionClass.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: yield this._getPanelSelector() })))();
58 });
59 }
60 /** Gets the option groups inside the autocomplete panel. */
61 getOptionGroups(filters) {
62 return __awaiter(this, void 0, void 0, function* () {
63 return this._documentRootLocator.locatorForAll(this._optionGroupClass.with(Object.assign(Object.assign({}, (filters || {})), { ancestor: yield this._getPanelSelector() })))();
64 });
65 }
66 /** Selects the first option matching the given filters. */
67 selectOption(filters) {
68 return __awaiter(this, void 0, void 0, function* () {
69 yield this.focus(); // Focus the input to make sure the autocomplete panel is shown.
70 const options = yield this.getOptions(filters);
71 if (!options.length) {
72 throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);
73 }
74 yield options[0].click();
75 });
76 }
77 /** Whether the autocomplete is open. */
78 isOpen() {
79 return __awaiter(this, void 0, void 0, function* () {
80 const panel = yield this._getPanel();
81 return !!panel && (yield panel.hasClass(`${this._prefix}-autocomplete-visible`));
82 });
83 }
84 /** Gets the panel associated with this autocomplete trigger. */
85 _getPanel() {
86 return __awaiter(this, void 0, void 0, function* () {
87 // Technically this is static, but it needs to be in a
88 // function, because the autocomplete's panel ID can changed.
89 return this._documentRootLocator.locatorForOptional(yield this._getPanelSelector())();
90 });
91 }
92 /** Gets the selector that can be used to find the autocomplete trigger's panel. */
93 _getPanelSelector() {
94 return __awaiter(this, void 0, void 0, function* () {
95 return `#${(yield (yield this.host()).getAttribute('aria-owns'))}`;
96 });
97 }
98}
99/** Harness for interacting with a standard mat-autocomplete in tests. */
100export class MatAutocompleteHarness extends _MatAutocompleteHarnessBase {
101 constructor() {
102 super(...arguments);
103 this._prefix = 'mat';
104 this._optionClass = MatOptionHarness;
105 this._optionGroupClass = MatOptgroupHarness;
106 }
107 /**
108 * Gets a `HarnessPredicate` that can be used to search for a `MatAutocompleteHarness` that meets
109 * certain criteria.
110 * @param options Options for filtering which autocomplete instances are considered a match.
111 * @return a `HarnessPredicate` configured with the given options.
112 */
113 static with(options = {}) {
114 return new HarnessPredicate(MatAutocompleteHarness, options)
115 .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value));
116 }
117}
118/** The selector for the host element of a `MatAutocomplete` instance. */
119MatAutocompleteHarness.hostSelector = '.mat-autocomplete-trigger';
120//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b2NvbXBsZXRlLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvYXV0b2NvbXBsZXRlL3Rlc3RpbmcvYXV0b2NvbXBsZXRlLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOztBQUVILE9BQU8sRUFBQyxxQkFBcUIsRUFBQyxNQUFNLHVCQUF1QixDQUFDO0FBQzVELE9BQU8sRUFFTCxnQkFBZ0IsRUFFaEIsZ0JBQWdCLEdBQ2pCLE1BQU0sc0JBQXNCLENBQUM7QUFDOUIsT0FBTyxFQUNMLGtCQUFrQixFQUNsQixnQkFBZ0IsRUFHakIsTUFBTSxnQ0FBZ0MsQ0FBQztBQUd4QyxNQUFNLE9BQWdCLDJCQVNwQixTQUFRLGdCQUFnQjtJQVQxQjs7UUFVVSx5QkFBb0IsR0FBRyxJQUFJLENBQUMsMEJBQTBCLEVBQUUsQ0FBQztJQStFbkUsQ0FBQztJQTFFQyxnREFBZ0Q7SUFDMUMsUUFBUTs7WUFDWixPQUFPLENBQUMsTUFBTSxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQyxXQUFXLENBQVMsT0FBTyxDQUFDLENBQUM7UUFDMUQsQ0FBQztLQUFBO0lBRUQsa0RBQWtEO0lBQzVDLFVBQVU7O1lBQ2QsTUFBTSxRQUFRLEdBQUcsQ0FBQyxNQUFNLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFDLFlBQVksQ0FBQyxVQUFVLENBQUMsQ0FBQztZQUM5RCxPQUFPLHFCQUFxQixDQUFDLE1B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