@angular/material
Version:
Angular Material
33 lines • 4.65 kB
JavaScript
/**
* @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 `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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3Jlc3MtYmFyLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvcHJvZ3Jlc3MtYmFyL3Rlc3RpbmcvcHJvZ3Jlc3MtYmFyLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLG9CQUFvQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDM0QsT0FBTyxFQUNMLGdCQUFnQixFQUVoQixnQkFBZ0IsR0FDakIsTUFBTSxzQkFBc0IsQ0FBQztBQUc5QixrRUFBa0U7QUFDbEUsTUFBTSxPQUFPLHFCQUFzQixTQUFRLGdCQUFnQjthQUNsRCxpQkFBWSxHQUFHLHVCQUF1QixDQUFDO0lBRTlDOzs7O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