{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/button-toggle/testing/button-toggle-harness.ts","../../../../../../../src/material/button-toggle/testing/button-toggle-group-harness.ts","../../../../../../../src/material/button-toggle/testing/public-api.ts","../../../../../../../src/material/button-toggle/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 {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {MatButtonToggleAppearance} from '@angular/material/button-toggle';\nimport {ButtonToggleHarnessFilters} from './button-toggle-harness-filters';\n\n\n/** Harness for interacting with a standard mat-button-toggle in tests. */\nexport class MatButtonToggleHarness extends ComponentHarness {\n  /** The selector for the host element of a `MatButton` instance. */\n  static hostSelector = '.mat-button-toggle';\n\n  private _label = this.locatorFor('.mat-button-toggle-label-content');\n  private _button = this.locatorFor('.mat-button-toggle-button');\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatButtonToggleHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which button toggle instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: ButtonToggleHarnessFilters = {}): HarnessPredicate<MatButtonToggleHarness> {\n    return new HarnessPredicate(MatButtonToggleHarness, options)\n        .addOption('text', options.text,\n            (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n        .addOption('name', options.name,\n            (harness, name) => HarnessPredicate.stringMatches(harness.getName(), name))\n        .addOption('checked', options.checked,\n            async (harness, checked) => (await harness.isChecked()) === checked);\n  }\n\n  /** Gets a boolean promise indicating if the button toggle is checked. */\n  async isChecked(): Promise<boolean> {\n    const checked = (await this._button()).getAttribute('aria-pressed');\n    return coerceBooleanProperty(await checked);\n  }\n\n  /** Gets a boolean promise indicating if the button toggle is disabled. */\n  async isDisabled(): Promise<boolean> {\n    const disabled = (await this._button()).getAttribute('disabled');\n    return coerceBooleanProperty(await disabled);\n  }\n\n  /** Gets a promise for the button toggle's name. */\n  async getName(): Promise<string | null> {\n    return (await this._button()).getAttribute('name');\n  }\n\n  /** Gets a promise for the button toggle's aria-label. */\n  async getAriaLabel(): Promise<string | null> {\n    return (await this._button()).getAttribute('aria-label');\n  }\n\n  /** Gets a promise for the button toggles's aria-labelledby. */\n  async getAriaLabelledby(): Promise<string | null> {\n    return (await this._button()).getAttribute('aria-labelledby');\n  }\n\n  /** Gets a promise for the button toggle's text. */\n  async getText(): Promise<string> {\n    return (await this._label()).text();\n  }\n\n  /** Gets the appearance that the button toggle is using. */\n  async getAppearance(): Promise<MatButtonToggleAppearance> {\n    const host = await this.host();\n    const className = 'mat-button-toggle-appearance-standard';\n    return await host.hasClass(className) ? 'standard' : 'legacy';\n  }\n\n  /** Focuses the toggle. */\n  async focus(): Promise<void> {\n    return (await this._button()).focus();\n  }\n\n  /** Blurs the toggle. */\n  async blur(): Promise<void> {\n    return (await this._button()).blur();\n  }\n\n  /** Whether the toggle is focused. */\n  async isFocused(): Promise<boolean> {\n    return (await this._button()).isFocused();\n  }\n\n  /** Toggle the checked state of the buttons toggle. */\n  async toggle(): Promise<void> {\n    return (await this._button()).click();\n  }\n\n  /**\n   * Puts the button toggle in a checked state by toggling it if it's\n   * currently unchecked, or doing nothing if it is already checked.\n   */\n  async check(): Promise<void> {\n    if (!(await this.isChecked())) {\n      await this.toggle();\n    }\n  }\n\n  /**\n   * Puts the button toggle in an unchecked state by toggling it if it's\n   * currently checked, or doing nothing if it's already unchecked.\n   */\n  async uncheck(): Promise<void> {\n    if (await this.isChecked()) {\n      await this.toggle();\n    }\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 {MatButtonToggleAppearance} from '@angular/material/button-toggle';\nimport {ButtonToggleGroupHarnessFilters} from './button-toggle-group-harness-filters';\nimport {ButtonToggleHarnessFilters} from './button-toggle-harness-filters';\nimport {MatButtonToggleHarness} from './button-toggle-harness';\n\n\n/** Harness for interacting with a standard mat-button-toggle in tests. */\nexport class MatButtonToggleGroupHarness extends ComponentHarness {\n  /** The selector for the host element of a `MatButton` instance. */\n  static hostSelector = '.mat-button-toggle-group';\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatButtonToggleGroupHarness`\n   * that meets certain criteria.\n   * @param options Options for filtering which button toggle instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: ButtonToggleGroupHarnessFilters = {}):\n    HarnessPredicate<MatButtonToggleGroupHarness> {\n    return new HarnessPredicate(MatButtonToggleGroupHarness, options);\n  }\n\n  /**\n   * Gets the button toggles that are inside the group.\n   * @param filter Optionally filters which toggles are included.\n   */\n  async getToggles(filter: ButtonToggleHarnessFilters = {}): Promise<MatButtonToggleHarness[]> {\n    return this.locatorForAll(MatButtonToggleHarness.with(filter))();\n  }\n\n  /** Gets whether the button toggle group is disabled. */\n  async isDisabled(): Promise<boolean> {\n    return await (await this.host()).getAttribute('aria-disabled') === 'true';\n  }\n\n  /** Gets whether the button toggle group is laid out vertically. */\n  async isVertical(): Promise<boolean> {\n    return (await this.host()).hasClass('mat-button-toggle-vertical');\n  }\n\n  /** Gets the appearance that the group is using. */\n  async getAppearance(): Promise<MatButtonToggleAppearance> {\n    const host = await this.host();\n    const className = 'mat-button-toggle-group-appearance-standard';\n    return await host.hasClass(className) ? 'standard' : 'legacy';\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 './button-toggle-harness';\nexport * from './button-toggle-harness-filters';\nexport * from './button-toggle-group-harness';\nexport * from './button-toggle-group-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an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