{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/legacy-core/testing/option-harness.ts","../../../../../../../src/material/legacy-core/testing/optgroup-harness.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 {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {LegacyOptionHarnessFilters} from './option-harness-filters';\n\n/**\n * Harness for interacting with a `mat-option` in tests.\n * @deprecated Use `MatOptionHarness` from `@angular/material/core/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport class MatLegacyOptionHarness extends ComponentHarness {\n  /** Selector used to locate option instances. */\n  static hostSelector = '.mat-option';\n\n  /** Element containing the option's text. */\n  private _text = this.locatorFor('.mat-option-text');\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatOptionsHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which option instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: LegacyOptionHarnessFilters = {}) {\n    return new HarnessPredicate(MatLegacyOptionHarness, options)\n      .addOption('text', options.text, async (harness, title) =>\n        HarnessPredicate.stringMatches(await harness.getText(), title),\n      )\n      .addOption(\n        'isSelected',\n        options.isSelected,\n        async (harness, isSelected) => (await harness.isSelected()) === isSelected,\n      );\n  }\n\n  /** Clicks the option. */\n  async click(): Promise<void> {\n    return (await this.host()).click();\n  }\n\n  /** Gets the option's label text. */\n  async getText(): Promise<string> {\n    return (await this._text()).text();\n  }\n\n  /** Gets whether the option is disabled. */\n  async isDisabled(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-option-disabled');\n  }\n\n  /** Gets whether the option is selected. */\n  async isSelected(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-selected');\n  }\n\n  /** Gets whether the option is active. */\n  async isActive(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-active');\n  }\n\n  /** Gets whether the option is in multiple selection mode. */\n  async isMultiple(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-option-multiple');\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 {LegacyOptgroupHarnessFilters} from './optgroup-harness-filters';\nimport {MatLegacyOptionHarness} from './option-harness';\nimport {LegacyOptionHarnessFilters} from './option-harness-filters';\n\n/**\n * Harness for interacting with a `mat-optgroup` in tests.\n * @deprecated Use `MatOptgroupHarness` from `@angular/material/core/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.\n * @breaking-change 17.0.0\n */\nexport class MatLegacyOptgroupHarness extends ComponentHarness {\n  /** Selector used to locate option group instances. */\n  static hostSelector = '.mat-optgroup';\n  private _label = this.locatorFor('.mat-optgroup-label');\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatOptgroupHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which option instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: LegacyOptgroupHarnessFilters = {}) {\n    return new HarnessPredicate(MatLegacyOptgroupHarness, options).addOption(\n      'labelText',\n      options.labelText,\n      async (harness, title) => HarnessPredicate.stringMatches(await harness.getLabelText(), title),\n    );\n  }\n\n  /** Gets the option group's label text. */\n  async getLabelText(): Promise<string> {\n    return (await this._label()).text();\n  }\n\n  /** Gets whether the option group is disabled. */\n  async isDisabled(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-optgroup-disabled');\n  }\n\n  /**\n   * Gets the options that are inside the group.\n   * @param filter Optionally filters which options are included.\n   */\n  async getOptions(filter: LegacyOptionHarnessFilters = {}): Promise<MatLegacyOptionHarness[]> {\n    return this.locatorForAll(MatLegacyOptionHarness.with(filter))();\n  }\n}\n"],"names":[],"mappings":";;AAWA;;;;AAIG;AACG,MAAO,sBA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