/** * @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 { coerceNumberProperty } from '@angular/cdk/coercion'; import { ComponentHarness, HarnessPredicate, } from '@angular/cdk/testing'; /** Harness for interacting with an MDC-based `mat-progress-bar` in tests. */ export class MatProgressBarHarness extends ComponentHarness { static { this.hostSelector = '.mat-mdc-progress-bar'; } /** * Gets a `HarnessPredicate` that can be used to search for a progress bar with specific * attributes. * @param options Options for filtering which progress bar instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(this, options); } /** Gets a promise for the progress bar's value. */ async getValue() { const host = await this.host(); const ariaValue = await host.getAttribute('aria-valuenow'); return ariaValue ? coerceNumberProperty(ariaValue) : null; } /** Gets a promise for the progress bar's mode. */ async getMode() { return (await this.host()).getAttribute('mode'); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3Jlc3MtYmFyLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvcHJvZ3Jlc3MtYmFyL3Rlc3RpbmcvcHJvZ3Jlc3MtYmFyLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLG9CQUFvQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDM0QsT0FBTyxFQUNMLGdCQUFnQixFQUVoQixnQkFBZ0IsR0FDakIsTUFBTSxzQkFBc0IsQ0FBQztBQUc5Qiw2RUFBNkU7QUFDN0UsTUFBTSxPQUFPLHFCQUFzQixTQUFRLGdCQUFnQjthQUNsRCxpQkFBWSxHQUFHLHVCQUF1QixDQUFDO0lBRTlDOzs7OztPQUtHO0lBQ0gsTUFBTSxDQUFDLElBQUksQ0FFVCxVQUFxQyxFQU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