source: trip-planner-front/node_modules/@angular/material/fesm2015/stepper/testing.js.map@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 13.9 KB
RevLine 
[6a3a178]1{"version":3,"file":"stepper__testing.js","sources":["../../../../../../src/material/stepper/testing/step-harness.ts","../../../../../../src/material/stepper/testing/stepper-harness.ts","../../../../../../src/material/stepper/testing/stepper-button-harnesses.ts","../../../../../../src/material/stepper/testing/public-api.ts","../../../../../../src/material/stepper/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ContentContainerComponentHarness,\n HarnessPredicate,\n HarnessLoader,\n} from '@angular/cdk/testing';\nimport {StepHarnessFilters} from './step-harness-filters';\n\n/** Harness for interacting with a standard Angular Material step in tests. */\nexport class MatStepHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatStep` instance. */\n static hostSelector = '.mat-step-header';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatStepHarness` that meets\n * certain criteria.\n * @param options Options for filtering which steps are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: StepHarnessFilters = {}): HarnessPredicate<MatStepHarness> {\n return new HarnessPredicate(MatStepHarness, options)\n .addOption('label', options.label,\n (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label))\n .addOption('selected', options.selected,\n async (harness, selected) => (await harness.isSelected()) === selected)\n .addOption('completed', options.completed,\n async (harness, completed) => (await harness.isCompleted()) === completed)\n .addOption('invalid', options.invalid,\n async (harness, invalid) => (await harness.hasErrors()) === invalid);\n }\n\n /** Gets the label of the step. */\n async getLabel(): Promise<string> {\n return (await this.locatorFor('.mat-step-text-label')()).text();\n }\n\n /** Gets the `aria-label` of the step. */\n async getAriaLabel(): Promise<string|null> {\n return (await this.host()).getAttribute('aria-label');\n }\n\n /** Gets the value of the `aria-labelledby` attribute. */\n async getAriaLabelledby(): Promise<string|null> {\n return (await this.host()).getAttribute('aria-labelledby');\n }\n\n /** Whether the step is selected. */\n async isSelected(): Promise<boolean> {\n const host = await this.host();\n return (await host.getAttribute('aria-selected')) === 'true';\n }\n\n /** Whether the step has been filled out. */\n async isCompleted(): Promise<boolean> {\n const state = await this._getIconState();\n return state === 'done' || (state === 'edit' && !(await this.isSelected()));\n }\n\n /**\n * Whether the step is currently showing its error state. Note that this doesn't mean that there\n * are or aren't any invalid form controls inside the step, but that the step is showing its\n * error-specific styling which depends on there being invalid controls, as well as the\n * `ErrorStateMatcher` determining that an error should be shown and that the `showErrors`\n * option was enabled through the `STEPPER_GLOBAL_OPTIONS` injection token.\n */\n async hasErrors(): Promise<boolean> {\n return (await this._getIconState()) === 'error';\n }\n\n /** Whether the step is optional. */\n async isOptional(): Promise<boolean> {\n // If the node with the optional text is present, it means that the step is optional.\n const optionalNode = await this.locatorForOptional('.mat-step-optional')();\n return !!optionalNode;\n }\n\n /**\n * Selects the given step by clicking on the label. The step may not be selected\n * if the stepper doesn't allow it (e.g. if there are validation errors).\n */\n async select(): Promise<void> {\n await (await this.host()).click();\n }\n\n protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n const contentId = await (await this.host()).getAttribute('aria-controls');\n return this.documentRootLocatorFactory().harnessLoaderFor(`#${contentId}`);\n }\n\n /**\n * Gets the state of the step. Note that we have a `StepState` which we could use to type the\n * return value, but it's basically the same as `string`, because the type has `| string`.\n */\n private async _getIconState(): Promise<string> {\n // The state is exposed on the icon with a class that looks like `mat-step-icon-state-{{state}}`\n const icon = await this.locatorFor('.mat-step-icon')();\n const classes = (await icon.getAttribute('class'))!;\n const match = classes.match(/mat-step-icon-state-([a-z]+)/);\n\n if (!match) {\n throw Error(`Could not determine step state from \"${classes}\".`);\n }\n\n return match[1];\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {MatStepHarness} from './step-harness';\nimport {\n StepperHarnessFilters,\n StepHarnessFilters,\n StepperOrientation,\n} from './step-harness-filters';\n\n/** Harness for interacting with a standard Material stepper in tests. */\nexport class MatStepperHarness extends ComponentHarness {\n /** The selector for the host element of a `MatStepper` instance. */\n static hostSelector = '.mat-stepper-horizontal, .mat-stepper-vertical';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatStepperHarness` that meets\n * certain criteria.\n * @param options Options for filtering which stepper instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: StepperHarnessFilters = {}): HarnessPredicate<MatStepperHarness> {\n return new HarnessPredicate(MatStepperHarness, options)\n .addOption('orientation', options.orientation,\n async (harness, orientation) => (await harness.getOrientation()) === orientation);\n }\n\n /**\n * Gets the list of steps in the stepper.\n * @param filter Optionally filters which steps are included.\n */\n async getSteps(filter: StepHarnessFilters = {}): Promise<MatStepHarness[]> {\n return this.locatorForAll(MatStepHarness.with(filter))();\n }\n\n /** Gets the orientation of the stepper. */\n async getOrientation(): Promise<StepperOrientation> {\n const host = await this.host();\n return (await host.hasClass('mat-stepper-horizontal')) ?\n StepperOrientation.HORIZONTAL : StepperOrientation.VERTICAL;\n }\n\n /**\n * Selects a step in this stepper.\n * @param filter An optional filter to apply to the child steps. The first step matching the\n * filter will be selected.\n */\n async selectStep(filter: StepHarnessFilters = {}): Promise<void> {\n const steps = await this.getSteps(filter);\n if (!steps.length) {\n throw Error(`Cannot find mat-step matching filter ${JSON.stringify(filter)}`);\n }\n await steps[0].select();\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {StepperButtonHarnessFilters} from './step-harness-filters';\n\n/** Base class for stepper button harnesses. */\nabstract class StepperButtonHarness extends ComponentHarness {\n /** Gets the text of the button. */\n async getText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Clicks the button. */\n async click(): Promise<void> {\n return (await this.host()).click();\n }\n}\n\n/** Harness for interacting with a standard Angular Material stepper next button in tests. */\nexport class MatStepperNextHarness extends StepperButtonHarness {\n /** The selector for the host element of a `MatStep` instance. */\n static hostSelector = '.mat-stepper-next';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatStepperNextHarness` that meets\n * certain criteria.\n * @param options Options for filtering which steps are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: StepperButtonHarnessFilters = {}): HarnessPredicate<MatStepperNextHarness> {\n return new HarnessPredicate(MatStepperNextHarness, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));\n }\n}\n\n\n/** Harness for interacting with a standard Angular Material stepper previous button in tests. */\nexport class MatStepperPreviousHarness extends StepperButtonHarness {\n /** The selector for the host element of a `MatStep` instance. */\n static hostSelector = '.mat-stepper-previous';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatStepperPreviousHarness`\n * that meets certain criteria.\n * @param options Options for filtering which steps are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: StepperButtonHarnessFilters = {}):\n HarnessPredicate<MatStepperPreviousHarness> {\n return new HarnessPredicate(MatStepperPreviousHarness, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './stepper-harness';\nexport * from './step-harness';\nexport * from './step-harness-filters';\nexport * from './stepper-button-harnesses';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './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