{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/expansion/testing/expansion-harness.ts","../../../../../../../src/material/expansion/testing/accordion-harness.ts","../../../../../../../src/material/expansion/testing/expansion-harness-filters.ts","../../../../../../../src/material/expansion/testing/public-api.ts","../../../../../../../src/material/expansion/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 {ExpansionPanelHarnessFilters} from './expansion-harness-filters';\n\n/** Selectors for the various `mat-expansion-panel` sections that may contain user content. */\nexport const enum MatExpansionPanelSection {\n  HEADER = '.mat-expansion-panel-header',\n  TITLE = '.mat-expansion-panel-header-title',\n  DESCRIPTION = '.mat-expansion-panel-header-description',\n  CONTENT = '.mat-expansion-panel-content'\n}\n\n/** Harness for interacting with a standard mat-expansion-panel in tests. */\nexport class MatExpansionPanelHarness extends\n  ContentContainerComponentHarness<MatExpansionPanelSection> {\n  static hostSelector = '.mat-expansion-panel';\n\n  private _header = this.locatorFor(MatExpansionPanelSection.HEADER);\n  private _title = this.locatorForOptional(MatExpansionPanelSection.TITLE);\n  private _description = this.locatorForOptional(MatExpansionPanelSection.DESCRIPTION);\n  private _expansionIndicator = this.locatorForOptional('.mat-expansion-indicator');\n  private _content = this.locatorFor(MatExpansionPanelSection.CONTENT);\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for an expansion-panel\n   * with specific attributes.\n   * @param options Options for narrowing the search:\n   *   - `title` finds an expansion-panel with a specific title text.\n   *   - `description` finds an expansion-panel with a specific description text.\n   *   - `expanded` finds an expansion-panel that is currently expanded.\n   *   - `disabled` finds an expansion-panel that is disabled.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: ExpansionPanelHarnessFilters = {}):\n      HarnessPredicate<MatExpansionPanelHarness> {\n    return new HarnessPredicate(MatExpansionPanelHarness, options)\n        .addOption(\n            'title', options.title,\n            (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title))\n        .addOption(\n            'description', options.description,\n            (harness, description) =>\n                HarnessPredicate.stringMatches(harness.getDescription(), description))\n        .addOption(\n            'content', options.content,\n            (harness, content) => HarnessPredicate.stringMatches(harness.getTextContent(), content))\n        .addOption(\n            'expanded', options.expanded,\n            async (harness, expanded) => (await harness.isExpanded()) === expanded)\n        .addOption(\n            'disabled', options.disabled,\n            async (harness, disabled) => (await harness.isDisabled()) === disabled);\n  }\n\n  /** Whether the panel is expanded. */\n  async isExpanded(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-expanded');\n  }\n\n  /**\n   * Gets the title text of the panel.\n   * @returns Title text or `null` if no title is set up.\n   */\n  async getTitle(): Promise<string|null> {\n    const titleEl = await this._title();\n    return titleEl ? titleEl.text() : null;\n  }\n\n  /**\n   * Gets the description text of the panel.\n   * @returns Description text or `null` if no description is set up.\n   */\n  async getDescription(): Promise<string|null> {\n    const descriptionEl = await this._description();\n    return descriptionEl ? descriptionEl.text() : null;\n  }\n\n  /** Whether the panel is disabled. */\n  async isDisabled(): Promise<boolean> {\n    return await (await this._header()).getAttribute('aria-disabled') === 'true';\n  }\n\n  /**\n   * Toggles the expanded state of the panel by clicking on the panel\n   * header. This method will not work if the panel is disabled.\n   */\n  async toggle(): Promise<void> {\n    await (await this._header()).click();\n  }\n\n  /** Expands the expansion panel if collapsed. */\n  async expand(): Promise<void> {\n    if (!await this.isExpanded()) {\n      await this.toggle();\n    }\n  }\n\n  /** Collapses the expansion panel if expanded. */\n  async collapse(): Promise<void> {\n    if (await this.isExpanded()) {\n      await this.toggle();\n    }\n  }\n\n  /** Gets the text content of the panel. */\n  async getTextContent(): Promise<string> {\n    return (await this._content()).text();\n  }\n\n  /**\n   * Gets a `HarnessLoader` that can be used to load harnesses for\n   * components within the panel's content area.\n   * @deprecated Use either `getChildLoader(MatExpansionPanelSection.CONTENT)`, `getHarness` or\n   *    `getAllHarnesses` instead.\n   * @breaking-change 12.0.0\n   */\n  async getHarnessLoaderForContent(): Promise<HarnessLoader> {\n    return this.getChildLoader(MatExpansionPanelSection.CONTENT);\n  }\n\n  /** Focuses the panel. */\n  async focus(): Promise<void> {\n    return (await this._header()).focus();\n  }\n\n  /** Blurs the panel. */\n  async blur(): Promise<void> {\n    return (await this._header()).blur();\n  }\n\n  /** Whether the panel is focused. */\n  async isFocused(): Promise<boolean> {\n    return (await this._header()).isFocused();\n  }\n\n  /** Whether the panel has a toggle indicator displayed. */\n  async hasToggleIndicator(): Promise<boolean> {\n    return (await this._expansionIndicator()) !== null;\n  }\n\n  /** Gets the position of the toggle indicator. */\n  async getToggleIndicatorPosition(): Promise<'before'|'after'> {\n    // By default the expansion indicator will show \"after\" the panel header content.\n    if (await (await this._header()).hasClass('mat-expansion-toggle-indicator-before')) {\n      return 'before';\n    }\n    return 'after';\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 {MatExpansionPanelHarness} from './expansion-harness';\nimport {AccordionHarnessFilters, ExpansionPanelHarnessFilters} from './expansion-harness-filters';\n\n/** Harness for interacting with a standard mat-accordion in tests. */\nexport class MatAccordionHarness extends ComponentHarness {\n  static hostSelector = '.mat-accordion';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for an accordion\n   * with specific attributes.\n   * @param options Options for narrowing the search.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: AccordionHarnessFilters = {}): HarnessPredicate<MatAccordionHarness> {\n    return new HarnessPredicate(MatAccordionHarness, options);\n  }\n\n  /** Gets all expansion panels which are part of the accordion. */\n  async getExpansionPanels(filter: ExpansionPanelHarnessFilters = {}):\n      Promise<MatExpansionPanelHarness[]> {\n    return this.locatorForAll(MatExpansionPanelHarness.with(filter))();\n  }\n\n  /** Whether the accordion allows multiple expanded panels simultaneously. */\n  async isMulti(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-accordion-multi');\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 {BaseHarnessFilters} from '@angular/cdk/testing';\n\nexport interface AccordionHarnessFilters extends BaseHarnessFilters {}\n\nexport interface ExpansionPanelHarnessFilters extends BaseHarnessFilters {\n  title?: string|RegExp|null;\n  description?: string|RegExp|null;\n  content?: string|RegExp;\n  expanded?: boolean;\n  disabled?: boolean;\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 './accordion-harness';\nexport * from './expansion-harness';\nexport * from './expansion-harness-filters';\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;;;;;;;AAuBA;MACa,wBAAyB,SACpC,gCAA0D;IAD5D;;QAIU,YAAO,GAAG,IAAI,CAAC,UAAU,4CAAiC,CAAC;QAC3D,WAAM,GAAG,IAAI,CAAC,kBAAkB,iDAAgC,CAAC;QACjE,iBAAY,GAAG,IAAI,CAAC,kBAAkB,6DAAsC,CAAC;QAC7E,wBAAmB,GAAG,IAAI,CAAC,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;QAC1E,aAAQ,GAAG,IAAI,CAAC,UAAU,8CAAkC,CAAC;KA+HtE;;;;;;;;;;;IAnHC,OAAO,IAAI,CAAC,UAAwC,EAAE;QAEpD,OAAO,IAAI,gBAAgB,CAAC,wBAAwB,EAAE,OAAO,CAAC;aACzD,SAAS,CACN,OAAO,EAAE,OAAO,CAAC,KAAK,EACtB,CAAC,OAAO,EAAE,KAA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