{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/tabs/testing/tab-harness.ts","../../../../../../../src/material/tabs/testing/tab-group-harness.ts","../../../../../../../src/material/tabs/testing/tab-link-harness.ts","../../../../../../../src/material/tabs/testing/tab-nav-bar-harness.ts","../../../../../../../src/material/tabs/testing/public-api.ts","../../../../../../../src/material/tabs/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  HarnessLoader,\n  HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {TabHarnessFilters} from './tab-harness-filters';\n\n/** Harness for interacting with a standard Angular Material tab-label in tests. */\nexport class MatTabHarness extends ContentContainerComponentHarness<string> {\n  /** The selector for the host element of a `MatTab` instance. */\n  static hostSelector = '.mat-tab-label';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatTabHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which tab instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: TabHarnessFilters = {}): HarnessPredicate<MatTabHarness> {\n    return new HarnessPredicate(MatTabHarness, options)\n        .addOption('label', options.label,\n            (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));\n  }\n\n  /** Gets the label of the tab. */\n  async getLabel(): Promise<string> {\n    return (await this.host()).text();\n  }\n\n  /** Gets the aria-label of the tab. */\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 tab is selected. */\n  async isSelected(): Promise<boolean> {\n    const hostEl = await this.host();\n    return (await hostEl.getAttribute('aria-selected')) === 'true';\n  }\n\n  /** Whether the tab is disabled. */\n  async isDisabled(): Promise<boolean> {\n    const hostEl = await this.host();\n    return (await hostEl.getAttribute('aria-disabled')) === 'true';\n  }\n\n  /** Selects the given tab by clicking on the label. Tab cannot be selected if disabled. */\n  async select(): Promise<void> {\n    await (await this.host()).click();\n  }\n\n  /** Gets the text content of the tab. */\n  async getTextContent(): Promise<string> {\n    const contentId = await this._getContentId();\n    const contentEl = await this.documentRootLocatorFactory().locatorFor(`#${contentId}`)();\n    return contentEl.text();\n  }\n\n  protected override async getRootHarnessLoader(): Promise<HarnessLoader> {\n    const contentId = await this._getContentId();\n    return this.documentRootLocatorFactory().harnessLoaderFor(`#${contentId}`);\n  }\n\n  /** Gets the element id for the content of the current tab. */\n  private async _getContentId(): Promise<string> {\n    const hostEl = await this.host();\n    // Tabs never have an empty \"aria-controls\" attribute.\n    return (await hostEl.getAttribute('aria-controls'))!;\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, parallel} from '@angular/cdk/testing';\nimport {TabGroupHarnessFilters, TabHarnessFilters} from './tab-harness-filters';\nimport {MatTabHarness} from './tab-harness';\n\n/** Harness for interacting with a standard mat-tab-group in tests. */\nexport class MatTabGroupHarness extends ComponentHarness {\n  /** The selector for the host element of a `MatTabGroup` instance. */\n  static hostSelector = '.mat-tab-group';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatTabGroupHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which tab group instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: TabGroupHarnessFilters = {}): HarnessPredicate<MatTabGroupHarness> {\n    return new HarnessPredicate(MatTabGroupHarness, options)\n        .addOption('selectedTabLabel', options.selectedTabLabel, async (harness, label) => {\n          const selectedTab = await harness.getSelectedTab();\n          return HarnessPredicate.stringMatches(await selectedTab.getLabel(), label);\n        });\n  }\n\n  /**\n   * Gets the list of tabs in the tab group.\n   * @param filter Optionally filters which tabs are included.\n   */\n  async getTabs(filter: TabHarnessFilters = {}): Promise<MatTabHarness[]> {\n    return this.locatorForAll(MatTabHarness.with(filter))();\n  }\n\n  /** Gets the selected tab of the tab group. */\n  async getSelectedTab(): Promise<MatTabHarness> {\n    const tabs = await this.getTabs();\n    const isSelected = await parallel(() => tabs.map(t => t.isSelected()));\n    for (let i = 0; i < tabs.length; i++) {\n      if (isSelected[i]) {\n        return tabs[i];\n      }\n    }\n    throw new Error('No selected tab could be found.');\n  }\n\n  /**\n   * Selects a tab in this tab group.\n   * @param filter An optional filter to apply to the child tabs. The first tab matching the filter\n   *     will be selected.\n   */\n  async selectTab(filter: TabHarnessFilters = {}): Promise<void> {\n    const tabs = await this.getTabs(filter);\n    if (!tabs.length) {\n      throw Error(`Cannot find mat-tab matching filter ${JSON.stringify(filter)}`);\n    }\n    await tabs[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 {TabLinkHarnessFilters} from './tab-harness-filters';\n\n/** Harness for interacting with a standard Angular Material tab link in tests. */\nexport class MatTabLinkHarness extends ComponentHarness {\n  /** The selector for the host element of a `MatTabLink` instance. */\n  static hostSelector = '.mat-tab-link';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatTabLinkHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which tab link instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: TabLinkHarnessFilters = {}): HarnessPredicate<MatTabLinkHarness> {\n    return new HarnessPredicate(MatTabLinkHarness, options)\n        .addOption('label', options.label,\n            (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));\n  }\n\n  /** Gets the label of the link. */\n  async getLabel(): Promise<string> {\n    return (await this.host()).text();\n  }\n\n  /** Whether the link is active. */\n  async isActive(): Promise<boolean> {\n    const host = await this.host();\n    return host.hasClass('mat-tab-label-active');\n  }\n\n  /** Whether the link is disabled. */\n  async isDisabled(): Promise<boolean> {\n    const host = await this.host();\n    return host.hasClass('mat-tab-disabled');\n  }\n\n  /** Clicks on the link. */\n  async click(): Promise<void> {\n    await (await this.host()).click();\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, parallel} from '@angular/cdk/testing';\nimport {TabNavBarHarnessFilters, TabLinkHarnessFilters} from './tab-harness-filters';\nimport {MatTabLinkHarness} from './tab-link-harness';\n\n/** Harness for interacting with a standard mat-tab-nav-bar in tests. */\nexport class MatTabNavBarHarness extends ComponentHarness {\n  /** The selector for the host element of a `MatTabNavBar` instance. */\n  static hostSelector = '.mat-tab-nav-bar';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatTabNavBar` that meets\n   * certain criteria.\n   * @param options Options for filtering which tab nav bar instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: TabNavBarHarnessFilters = {}): HarnessPredicate<MatTabNavBarHarness> {\n    return new HarnessPredicate(MatTabNavBarHarness, options);\n  }\n\n  /**\n   * Gets the list of links in the nav bar.\n   * @param filter Optionally filters which links are included.\n   */\n  async getLinks(filter: TabLinkHarnessFilters = {}): Promise<MatTabLinkHarness[]> {\n    return this.locatorForAll(MatTabLinkHarness.with(filter))();\n  }\n\n  /** Gets the active link in the nav bar. */\n  async getActiveLink(): Promise<MatTabLinkHarness> {\n    const links = await this.getLinks();\n    const isActive = await parallel(() => links.map(t => t.isActive()));\n    for (let i = 0; i < links.length; i++) {\n      if (isActive[i]) {\n        return links[i];\n      }\n    }\n    throw new Error('No active link could be found.');\n  }\n\n  /**\n   * Clicks a link inside the nav bar.\n   * @param filter An optional filter to apply to the child link. The first link matching the filter\n   *     will be clicked.\n   */\n  async clickLink(filter: TabLinkHarnessFilters = {}): Promise<void> {\n    const tabs = await this.getLinks(filter);\n    if (!tabs.length) {\n      throw Error(`Cannot find mat-tab-link matching filter ${JSON.stringify(filter)}`);\n    }\n    await tabs[0].click();\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 './tab-group-harness';\nexport * from './tab-harness';\nexport * from './tab-harness-filters';\nexport * from './tab-nav-bar-harness';\nexport * from './tab-link-harness';\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 './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAeA;MACa,aAAc,SAAQ,gCAAwC;;;;;;;IAUzE,OAAO,IAAI,CAAC,UAA6B,EAAE;QACzC,OAAO,IAAI,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC;aAC9C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAC7B,CAAC,OAAO,EAAE,KAAK,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;KACxF;;IAGD,MAAM,QAAQ;QACZ,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;KACnC;;IAGD,MAAM,YAAY;QAChB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACvD;;IAGD,MAAM,iBAAiB;QACrB,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;KAC5D;;IAGD,MAAM,UAAU;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACjC,OAAO,CAAC,MAAM,MAAM,CA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