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-spinner in tests. */
|
---|
13 | class MatProgressSpinnerHarness extends ComponentHarness {
|
---|
14 | /**
|
---|
15 | * Gets a `HarnessPredicate` that can be used to search for a `MatProgressSpinnerHarness` that
|
---|
16 | * meets certain criteria.
|
---|
17 | * @param options Options for filtering which progress spinner instances are considered a match.
|
---|
18 | * @return a `HarnessPredicate` configured with the given options.
|
---|
19 | */
|
---|
20 | static with(options = {}) {
|
---|
21 | return new HarnessPredicate(MatProgressSpinnerHarness, options);
|
---|
22 | }
|
---|
23 | /** Gets the progress spinner'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 spinner's mode. */
|
---|
32 | getMode() {
|
---|
33 | return __awaiter(this, void 0, void 0, function* () {
|
---|
34 | const modeAttr = (yield this.host()).getAttribute('mode');
|
---|
35 | return yield modeAttr;
|
---|
36 | });
|
---|
37 | }
|
---|
38 | }
|
---|
39 | /** The selector for the host element of a `MatProgressSpinner` instance. */
|
---|
40 | MatProgressSpinnerHarness.hostSelector = '.mat-progress-spinner';
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * @license
|
---|
44 | * Copyright Google LLC All Rights Reserved.
|
---|
45 | *
|
---|
46 | * Use of this source code is governed by an MIT-style license that can be
|
---|
47 | * found in the LICENSE file at https://angular.io/license
|
---|
48 | */
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * @license
|
---|
52 | * Copyright Google LLC All Rights Reserved.
|
---|
53 | *
|
---|
54 | * Use of this source code is governed by an MIT-style license that can be
|
---|
55 | * found in the LICENSE file at https://angular.io/license
|
---|
56 | */
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * @license
|
---|
60 | * Copyright Google LLC All Rights Reserved.
|
---|
61 | *
|
---|
62 | * Use of this source code is governed by an MIT-style license that can be
|
---|
63 | * found in the LICENSE file at https://angular.io/license
|
---|
64 | */
|
---|
65 |
|
---|
66 | export { MatProgressSpinnerHarness };
|
---|
67 | //# sourceMappingURL=testing.js.map
|
---|