1 | import { __awaiter } from 'tslib';
|
---|
2 | import { coerceNumberProperty } from '@angular/cdk/coercion';
|
---|
3 | import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * @license
|
---|
7 | * Copyright Google LLC All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Use of this source code is governed by an MIT-style license that can be
|
---|
10 | * found in the LICENSE file at https://angular.io/license
|
---|
11 | */
|
---|
12 | /** Harness for interacting with a standard mat-progress-bar in tests. */
|
---|
13 | class MatProgressBarHarness extends ComponentHarness {
|
---|
14 | /**
|
---|
15 | * Gets a `HarnessPredicate` that can be used to search for a `MatProgressBarHarness` that meets
|
---|
16 | * certain criteria.
|
---|
17 | * @param options Options for filtering which progress bar instances are considered a match.
|
---|
18 | * @return a `HarnessPredicate` configured with the given options.
|
---|
19 | */
|
---|
20 | static with(options = {}) {
|
---|
21 | return new HarnessPredicate(MatProgressBarHarness, options);
|
---|
22 | }
|
---|
23 | /** Gets the progress bar's value. */
|
---|
24 | getValue() {
|
---|
25 | return __awaiter(this, void 0, void 0, function* () {
|
---|
26 | const host = yield this.host();
|
---|
27 | const ariaValue = yield host.getAttribute('aria-valuenow');
|
---|
28 | return ariaValue ? coerceNumberProperty(ariaValue) : null;
|
---|
29 | });
|
---|
30 | }
|
---|
31 | /** Gets the progress bar's mode. */
|
---|
32 | getMode() {
|
---|
33 | return __awaiter(this, void 0, void 0, function* () {
|
---|
34 | return (yield this.host()).getAttribute('mode');
|
---|
35 | });
|
---|
36 | }
|
---|
37 | }
|
---|
38 | /** The selector for the host element of a `MatProgressBar` instance. */
|
---|
39 | MatProgressBarHarness.hostSelector = '.mat-progress-bar';
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * @license
|
---|
43 | * Copyright Google LLC All Rights Reserved.
|
---|
44 | *
|
---|
45 | * Use of this source code is governed by an MIT-style license that can be
|
---|
46 | * found in the LICENSE file at https://angular.io/license
|
---|
47 | */
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * @license
|
---|
51 | * Copyright Google LLC All Rights Reserved.
|
---|
52 | *
|
---|
53 | * Use of this source code is governed by an MIT-style license that can be
|
---|
54 | * found in the LICENSE file at https://angular.io/license
|
---|
55 | */
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * @license
|
---|
59 | * Copyright Google LLC All Rights Reserved.
|
---|
60 | *
|
---|
61 | * Use of this source code is governed by an MIT-style license that can be
|
---|
62 | * found in the LICENSE file at https://angular.io/license
|
---|
63 | */
|
---|
64 |
|
---|
65 | export { MatProgressBarHarness };
|
---|
66 | //# sourceMappingURL=testing.js.map
|
---|