{"version":3,"file":"expansion-testing.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/material/expansion/testing/expansion-harness.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/material/expansion/testing/accordion-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.dev/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 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 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(\n    options: ExpansionPanelHarnessFilters = {},\n  ): HarnessPredicate<MatExpansionPanelHarness> {\n    return new HarnessPredicate(MatExpansionPanelHarness, options)\n      .addOption('title', options.title, (harness, title) =>\n        HarnessPredicate.stringMatches(harness.getTitle(), title),\n      )\n      .addOption('description', options.description, (harness, description) =>\n        HarnessPredicate.stringMatches(harness.getDescription(), description),\n      )\n      .addOption('content', options.content, (harness, content) =>\n        HarnessPredicate.stringMatches(harness.getTextContent(), content),\n      )\n      .addOption(\n        'expanded',\n        options.expanded,\n        async (harness, expanded) => (await harness.isExpanded()) === expanded,\n      )\n      .addOption(\n        'disabled',\n        options.disabled,\n        async (harness, disabled) => (await harness.isDisabled()) === disabled,\n      );\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.dev/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(\n    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"],"names":["MatExpansionPanelSection","MatExpansionPanelHarness","ContentContainerComponentHarness","hostSelector","_header","locatorFor","HEADER","_title","locatorForOptional","TITLE","_description","DESCRIPTION","_expansionIndicator","_content","CONTENT","with","options","HarnessPredicate","addOption","title","harness","stringMatches","getTitle","description","getDescription","content","getTextContent","expanded","isExpanded","disabled","isDisabled","host","hasClass","titleEl","text","descriptionEl","getAttribute","toggle","click","expand","collapse","getHarnessLoaderForContent","getChildLoader","focus","blur","isFocused","hasToggleIndicator","getToggleIndicatorPosition","MatAccordionHarness","ComponentHarness","getExpansionPanels","filter","locatorForAll","isMulti"],"mappings":";;IAgBYA;AAAZ,CAAA,UAAYA,wBAAwB,EAAA;AAClCA,EAAAA,wBAAA,CAAA,QAAA,CAAA,GAAA,6BAAsC;AACtCA,EAAAA,wBAAA,CAAA,OAAA,CAAA,GAAA,mCAA2C;AAC3CA,EAAAA,wBAAA,CAAA,aAAA,CAAA,GAAA,yCAAuD;AACvDA,EAAAA,wBAAA,CAAA,SAAA,CAAA,GAAA,8BAAwC;AAC1C,CAAC,EALWA,wBAAwB,KAAxBA,wBAAwB,GAKnC,EAAA,CAAA,CAAA;AAGK,MAAOC,wBAAyB,SAAQC,gCAA0D,CAAA;EACtG,OAAOC,YAAY,GAAG,sBAAsB;EAEpCC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACL,wBAAwB,CAACM,MAAM,CAAC;EAC1DC,MAAM,GAAG,IAAI,CAACC,kBAAkB,CAACR,wBAAwB,CAACS,KAAK,CAAC;EAChEC,YAAY,GAAG,IAAI,CAACF,kBAAkB,CAACR,wBAAwB,CAACW,WAAW,CAAC;AAC5EC,EAAAA,mBAAmB,GAAG,IAAI,CAACJ,kBAAkB,CAAC,0BAA0B,CAAC;EACzEK,QAAQ,GAAG,IAAI,C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