/** * @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 { ContentContainerComponentHarness, HarnessPredicate, } from '@angular/cdk/testing'; /** Harness for interacting with a standard Angular Material step in tests. */ export class MatStepHarness extends ContentContainerComponentHarness { /** The selector for the host element of a `MatStep` instance. */ static { this.hostSelector = '.mat-step-header'; } /** * Gets a `HarnessPredicate` that can be used to search for a `MatStepHarness` that meets * certain criteria. * @param options Options for filtering which steps are considered a match. * @return a `HarnessPredicate` configured with the given options. */ static with(options = {}) { return new HarnessPredicate(MatStepHarness, options) .addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label)) .addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected) .addOption('completed', options.completed, async (harness, completed) => (await harness.isCompleted()) === completed) .addOption('invalid', options.invalid, async (harness, invalid) => (await harness.hasErrors()) === invalid); } /** Gets the label of the step. */ async getLabel() { return (await this.locatorFor('.mat-step-text-label')()).text(); } /** Gets the `aria-label` of the step. */ async getAriaLabel() { return (await this.host()).getAttribute('aria-label'); } /** Gets the value of the `aria-labelledby` attribute. */ async getAriaLabelledby() { return (await this.host()).getAttribute('aria-labelledby'); } /** Whether the step is selected. */ async isSelected() { const host = await this.host(); return (await host.getAttribute('aria-selected')) === 'true'; } /** Whether the step has been filled out. */ async isCompleted() { const state = await this._getIconState(); return state === 'done' || (state === 'edit' && !(await this.isSelected())); } /** * Whether the step is currently showing its error state. Note that this doesn't mean that there * are or aren't any invalid form controls inside the step, but that the step is showing its * error-specific styling which depends on there being invalid controls, as well as the * `ErrorStateMatcher` determining that an error should be shown and that the `showErrors` * option was enabled through the `STEPPER_GLOBAL_OPTIONS` injection token. */ async hasErrors() { return (await this._getIconState()) === 'error'; } /** Whether the step is optional. */ async isOptional() { // If the node with the optional text is present, it means that the step is optional. const optionalNode = await this.locatorForOptional('.mat-step-optional')(); return !!optionalNode; } /** * Selects the given step by clicking on the label. The step may not be selected * if the stepper doesn't allow it (e.g. if there are validation errors). */ async select() { await (await this.host()).click(); } async getRootHarnessLoader() { const contentId = await (await this.host()).getAttribute('aria-controls'); return this.documentRootLocatorFactory().harnessLoaderFor(`#${contentId}`); } /** * Gets the state of the step. Note that we have a `StepState` which we could use to type the * return value, but it's basically the same as `string`, because the type has `| string`. */ async _getIconState() { // The state is exposed on the icon with a class that looks like `mat-step-icon-state-{{state}}` const icon = await this.locatorFor('.mat-step-icon')(); const classes = (await icon.getAttribute('class')); const match = classes.match(/mat-step-icon-state-([a-z]+)/); if (!match) { throw Error(`Could not determine step state from "${classes}".`); } return match[1]; } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1oYXJuZXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3N0ZXBwZXIvdGVzdGluZy9zdGVwLWhhcm5lc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUNMLGdDQUFnQyxFQUNoQyxnQkFBZ0IsR0FFakIsTUFBTSxzQkFBc0IsQ0FBQztBQUc5Qiw4RUFBOEU7QUFDOUUsTUFBTSxPQUFPLGNBQWUsU0FBUSxnQ0FBd0M7SUFDMUUsaUVBQWlFO2FBQzFELGlCQUFZLEdBQUcsa0JBQWtCLENBQUM7SUFFekM7Ozs7O09BS0c7SUFDSCxNQUFNLENBQUMsSUFBSSxDQUFDLFVBQThCLEVBQUU7UUFDMUMsT0FBTyxJQUFJLGdCQUFnQixDQUFDLGNBQWMsRUFBRSxPQUFPLENBQUM7YUFDakQsU0FBUyxDQUFDLE9BQU8sRUFBRSxPQUFPLENBQUMsS0FBSyxFQUFFLENBQUMsT0FBTyxFQUFFLEtBQUssRUFBRSxFQUFFLENBQ3BELGdCQUFnQixDQUFDLGFBQWEsQ0FBQyxP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