source: trip-planner-front/node_modules/@angular/material/esm2015/progress-bar/testing/progress-bar-harness.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { __awaiter } from "tslib";
9import { coerceNumberProperty } from '@angular/cdk/coercion';
10import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
11/** Harness for interacting with a standard mat-progress-bar in tests. */
12export class MatProgressBarHarness extends ComponentHarness {
13 /**
14 * Gets a `HarnessPredicate` that can be used to search for a `MatProgressBarHarness` that meets
15 * certain criteria.
16 * @param options Options for filtering which progress bar instances are considered a match.
17 * @return a `HarnessPredicate` configured with the given options.
18 */
19 static with(options = {}) {
20 return new HarnessPredicate(MatProgressBarHarness, options);
21 }
22 /** Gets the progress bar's value. */
23 getValue() {
24 return __awaiter(this, void 0, void 0, function* () {
25 const host = yield this.host();
26 const ariaValue = yield host.getAttribute('aria-valuenow');
27 return ariaValue ? coerceNumberProperty(ariaValue) : null;
28 });
29 }
30 /** Gets the progress bar's mode. */
31 getMode() {
32 return __awaiter(this, void 0, void 0, function* () {
33 return (yield this.host()).getAttribute('mode');
34 });
35 }
36}
37/** The selector for the host element of a `MatProgressBar` instance. */
38MatProgressBarHarness.hostSelector = '.mat-progress-bar';
39//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3Jlc3MtYmFyLWhhcm5lc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvcHJvZ3Jlc3MtYmFyL3Rlc3RpbmcvcHJvZ3Jlc3MtYmFyLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6I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