/** * @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 a MDC based mat-progress-spinner in tests. */ export class MatProgressSpinnerHarness extends ComponentHarness { /** The selector for the host element of a `MatProgressSpinner` instance. */ static { this.hostSelector = '.mat-mdc-progress-spinner'; } /** * Gets a `HarnessPredicate` that can be used to search for a progress spinnner with specific * attributes. * @param options Options for filtering which progress spinner instances are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(this, options); } /** Gets the progress spinner's value. */ async getValue() { const host = await this.host(); const ariaValue = await host.getAttribute('aria-valuenow'); return ariaValue ? coerceNumberProperty(ariaValue) : null; } /** Gets the progress spinner's mode. */ async getMode() { const modeAttr = (await this.host()).getAttribute('mode'); return (await modeAttr); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3Jlc3Mtc3Bpbm5lci1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3Byb2dyZXNzLXNwaW5uZXIvdGVzdGluZy9wcm9ncmVzcy1zcGlubmVyLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLG9CQUFvQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDM0QsT0FBTyxFQUNMLGdCQUFnQixFQUVoQixnQkFBZ0IsR0FDakIsTUFBTSxzQkFBc0IsQ0FBQztBQUk5Qiw4RUFBOEU7QUFDOUUsTUFBTSxPQUFPLHlCQUEwQixTQUFRLGdCQUFnQjtJQUM3RCw0RUFBNEU7YUFDckUsaUJBQVksR0FBRywyQkFBMkIsQ0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