/** * @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 { ComponentHarness, HarnessPredicate, } from '@angular/cdk/testing'; /** Harness for interacting with an editable chip's input in tests. */ export class MatChipEditInputHarness extends ComponentHarness { static { this.hostSelector = '.mat-chip-edit-input'; } /** * Gets a `HarnessPredicate` that can be used to search for a chip edit input with specific * attributes. * @param options Options for filtering which input instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(this, options); } /** Sets the value of the input. */ async setValue(value) { const host = await this.host(); // @breaking-change 16.0.0 Remove this null check once `setContenteditableValue` // becomes a required method. if (!host.setContenteditableValue) { throw new Error('Cannot set chip edit input value, because test ' + 'element does not implement the `setContenteditableValue` method.'); } return host.setContenteditableValue(value); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hpcC1lZGl0LWlucHV0LWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvY2hpcHMvdGVzdGluZy9jaGlwLWVkaXQtaW5wdXQtaGFybmVzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQ0wsZ0JBQWdCLEVBRWhCLGdCQUFnQixHQUNqQixNQUFNLHNCQUFzQixDQUFDO0FBRzlCLHNFQUFzRTtBQUN0RSxNQUFNLE9BQU8sdUJBQXdCLFNBQVEsZ0JBQWdCO2FBQ3BELGlCQUFZLEdBQUcsc0JBQXNCLENBQUM7SUFFN0M7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUVULFVBQXVDLEVBQUU7UUFFekMsT0FBTyxJQUFJLGdCQUFnQixDQUFDLElBQUksRUFBRSxPQUFPLENBQUMsQ0FBQztJQUM3QyxDQUFDO0lBRUQs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