/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { HarnessPredicate } from '@angular/cdk/testing'; import { MatLegacyOptgroupHarness, MatLegacyOptionHarness, } from '@angular/material/legacy-core/testing'; import { _MatAutocompleteHarnessBase } from '@angular/material/autocomplete/testing'; /** * Harness for interacting with a standard mat-autocomplete in tests. * @deprecated Use `MatAutocompleteHarness` from `@angular/material/autocomplete/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. * @breaking-change 17.0.0 */ export class MatLegacyAutocompleteHarness extends _MatAutocompleteHarnessBase { constructor() { super(...arguments); this._prefix = 'mat'; this._optionClass = MatLegacyOptionHarness; this._optionGroupClass = MatLegacyOptgroupHarness; } /** The selector for the host element of a `MatAutocomplete` instance. */ static { this.hostSelector = '.mat-autocomplete-trigger'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatAutocompleteHarness` that meets * certain criteria. * @param options Options for filtering which autocomplete instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatLegacyAutocompleteHarness, options) .addOption('value', options.value, (harness, value) => HarnessPredicate.stringMatches(harness.getValue(), value)) .addOption('disabled', options.disabled, async (harness, disabled) => { return (await harness.isDisabled()) === disabled; }); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b2NvbXBsZXRlLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvbGVnYWN5LWF1dG9jb21wbGV0ZS90ZXN0aW5nL2F1dG9jb21wbGV0ZS1oYXJuZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxnQkFBZ0IsRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQ3RELE9BQU8sR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