{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/button-toggle/testing/button-toggle-harness.ts","../../../../../../../src/material/button-toggle/testing/button-toggle-harness-filters.ts","../../../../../../../src/material/button-toggle/testing/button-toggle-group-harness.ts","../../../../../../../src/material/button-toggle/testing/button-toggle-group-harness-filters.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 {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** Criteria that can be used to filter a list of `MatButtonToggleHarness` instances. */\nexport interface ButtonToggleHarnessFilters extends BaseHarnessFilters {\n  /** Only find instances whose text matches the given value. */\n  text?: string | RegExp;\n  /** Only find instances whose name matches the given value. */\n  name?: string | RegExp;\n  /** Only find instances that are checked. */\n  checked?: 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\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\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** Criteria that can be used to filter a list of `MatButtonToggleGroupHarness` instances. */\nexport interface ButtonToggleGroupHarnessFilters extends BaseHarnessFilters {\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 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;;;;;;;AAcA;MACa,sBAAuB,SAAQ,gBAAgB;IAA5D;;QAIU,WAAM,GAAG,IAAI,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC;QAC7D,YAAO,GAAG,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;KAgGhE;;;;;;;IAxFC,OAAO,IAAI,CAAC,UAAsC,EAAE;QAClD,OAAO,IAAI,gBAAgB,CAAC,sBAAsB,EAAE,OAAO,CAAC;aACvD,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAC3B,CAAC,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;aAC9E,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,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