source: trip-planner-front/node_modules/@angular/material/esm2015/stepper/testing/step-harness.js

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

initial commit

  • Property mode set to 100644
File size: 14.7 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 { ContentContainerComponentHarness, HarnessPredicate, } from '@angular/cdk/testing';
10/** Harness for interacting with a standard Angular Material step in tests. */
11export class MatStepHarness extends ContentContainerComponentHarness {
12 /**
13 * Gets a `HarnessPredicate` that can be used to search for a `MatStepHarness` that meets
14 * certain criteria.
15 * @param options Options for filtering which steps are considered a match.
16 * @return a `HarnessPredicate` configured with the given options.
17 */
18 static with(options = {}) {
19 return new HarnessPredicate(MatStepHarness, options)
20 .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))
21 .addOption('selected', options.selected, (harness, selected) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isSelected()) === selected; }))
22 .addOption('completed', options.completed, (harness, completed) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isCompleted()) === completed; }))
23 .addOption('invalid', options.invalid, (harness, invalid) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasErrors()) === invalid; }));
24 }
25 /** Gets the label of the step. */
26 getLabel() {
27 return __awaiter(this, void 0, void 0, function* () {
28 return (yield this.locatorFor('.mat-step-text-label')()).text();
29 });
30 }
31 /** Gets the `aria-label` of the step. */
32 getAriaLabel() {
33 return __awaiter(this, void 0, void 0, function* () {
34 return (yield this.host()).getAttribute('aria-label');
35 });
36 }
37 /** Gets the value of the `aria-labelledby` attribute. */
38 getAriaLabelledby() {
39 return __awaiter(this, void 0, void 0, function* () {
40 return (yield this.host()).getAttribute('aria-labelledby');
41 });
42 }
43 /** Whether the step is selected. */
44 isSelected() {
45 return __awaiter(this, void 0, void 0, function* () {
46 const host = yield this.host();
47 return (yield host.getAttribute('aria-selected')) === 'true';
48 });
49 }
50 /** Whether the step has been filled out. */
51 isCompleted() {
52 return __awaiter(this, void 0, void 0, function* () {
53 const state = yield this._getIconState();
54 return state === 'done' || (state === 'edit' && !(yield this.isSelected()));
55 });
56 }
57 /**
58 * Whether the step is currently showing its error state. Note that this doesn't mean that there
59 * are or aren't any invalid form controls inside the step, but that the step is showing its
60 * error-specific styling which depends on there being invalid controls, as well as the
61 * `ErrorStateMatcher` determining that an error should be shown and that the `showErrors`
62 * option was enabled through the `STEPPER_GLOBAL_OPTIONS` injection token.
63 */
64 hasErrors() {
65 return __awaiter(this, void 0, void 0, function* () {
66 return (yield this._getIconState()) === 'error';
67 });
68 }
69 /** Whether the step is optional. */
70 isOptional() {
71 return __awaiter(this, void 0, void 0, function* () {
72 // If the node with the optional text is present, it means that the step is optional.
73 const optionalNode = yield this.locatorForOptional('.mat-step-optional')();
74 return !!optionalNode;
75 });
76 }
77 /**
78 * Selects the given step by clicking on the label. The step may not be selected
79 * if the stepper doesn't allow it (e.g. if there are validation errors).
80 */
81 select() {
82 return __awaiter(this, void 0, void 0, function* () {
83 yield (yield this.host()).click();
84 });
85 }
86 getRootHarnessLoader() {
87 return __awaiter(this, void 0, void 0, function* () {
88 const contentId = yield (yield this.host()).getAttribute('aria-controls');
89 return this.documentRootLocatorFactory().harnessLoaderFor(`#${contentId}`);
90 });
91 }
92 /**
93 * Gets the state of the step. Note that we have a `StepState` which we could use to type the
94 * return value, but it's basically the same as `string`, because the type has `| string`.
95 */
96 _getIconState() {
97 return __awaiter(this, void 0, void 0, function* () {
98 // The state is exposed on the icon with a class that looks like `mat-step-icon-state-{{state}}`
99 const icon = yield this.locatorFor('.mat-step-icon')();
100 const classes = (yield icon.getAttribute('class'));
101 const match = classes.match(/mat-step-icon-state-([a-z]+)/);
102 if (!match) {
103 throw Error(`Could not determine step state from "${classes}".`);
104 }
105 return match[1];
106 });
107 }
108}
109/** The selector for the host element of a `MatStep` instance. */
110MatStepHar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