source: trip-planner-front/node_modules/@angular/material/esm2015/stepper/testing/stepper-button-harnesses.js@ 84d0fbb

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

initial commit

  • Property mode set to 100644
File size: 7.2 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 { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
10/** Base class for stepper button harnesses. */
11class StepperButtonHarness extends ComponentHarness {
12 /** Gets the text of the button. */
13 getText() {
14 return __awaiter(this, void 0, void 0, function* () {
15 return (yield this.host()).text();
16 });
17 }
18 /** Clicks the button. */
19 click() {
20 return __awaiter(this, void 0, void 0, function* () {
21 return (yield this.host()).click();
22 });
23 }
24}
25/** Harness for interacting with a standard Angular Material stepper next button in tests. */
26export class MatStepperNextHarness extends StepperButtonHarness {
27 /**
28 * Gets a `HarnessPredicate` that can be used to search for a `MatStepperNextHarness` that meets
29 * certain criteria.
30 * @param options Options for filtering which steps are considered a match.
31 * @return a `HarnessPredicate` configured with the given options.
32 */
33 static with(options = {}) {
34 return new HarnessPredicate(MatStepperNextHarness, options)
35 .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
36 }
37}
38/** The selector for the host element of a `MatStep` instance. */
39MatStepperNextHarness.hostSelector = '.mat-stepper-next';
40/** Harness for interacting with a standard Angular Material stepper previous button in tests. */
41export class MatStepperPreviousHarness extends StepperButtonHarness {
42 /**
43 * Gets a `HarnessPredicate` that can be used to search for a `MatStepperPreviousHarness`
44 * that meets certain criteria.
45 * @param options Options for filtering which steps are considered a match.
46 * @return a `HarnessPredicate` configured with the given options.
47 */
48 static with(options = {}) {
49 return new HarnessPredicate(MatStepperPreviousHarness, options)
50 .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
51 }
52}
53/** The selector for the host element of a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