/** * @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 { __awaiter } from "tslib"; import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing'; /** Base class for stepper button harnesses. */ class StepperButtonHarness extends ComponentHarness { /** Gets the text of the button. */ getText() { return __awaiter(this, void 0, void 0, function* () { return (yield this.host()).text(); }); } /** Clicks the button. */ click() { return __awaiter(this, void 0, void 0, function* () { return (yield this.host()).click(); }); } } /** Harness for interacting with a standard Angular Material stepper next button in tests. */ export class MatStepperNextHarness extends StepperButtonHarness { /** * Gets a `HarnessPredicate` that can be used to search for a `MatStepperNextHarness` 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(MatStepperNextHarness, options) .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)); } } /** The selector for the host element of a `MatStep` instance. */ MatStepperNextHarness.hostSelector = '.mat-stepper-next'; /** Harness for interacting with a standard Angular Material stepper previous button in tests. */ export class MatStepperPreviousHarness extends StepperButtonHarness { /** * Gets a `HarnessPredicate` that can be used to search for a `MatStepperPreviousHarness` * 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(MatStepperPreviousHarness, options) .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text)); } } /** The selector for the host element of a `MatStep` instance. */ MatStepperPreviousHarness.hostSelector = '.mat-stepper-previous'; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcHBlci1idXR0b24taGFybmVzc2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3N0ZXBwZXIvdGVzdGluZy9zdGVwcGVyLWJ1dHRvbi1oYXJuZXNzZXMudH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