{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/button/testing/button-harness.ts","../../../../../../../src/material/button/testing/public-api.ts","../../../../../../../src/material/button/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 {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {ButtonHarnessFilters} from './button-harness-filters';\n\n/** Harness for interacting with a standard mat-button in tests. */\nexport class MatButtonHarness extends ContentContainerComponentHarness {\n  // TODO(jelbourn) use a single class, like `.mat-button-base`\n  /** The selector for the host element of a `MatButton` instance. */\n  static hostSelector = `[mat-button], [mat-raised-button], [mat-flat-button], [mat-icon-button],\n                         [mat-stroked-button], [mat-fab], [mat-mini-fab]`;\n\n  /**\n   * Gets a `HarnessPredicate` that can be used to search for a `MatButtonHarness` that meets\n   * certain criteria.\n   * @param options Options for filtering which button instances are considered a match.\n   * @return a `HarnessPredicate` configured with the given options.\n   */\n  static with(options: ButtonHarnessFilters = {}): HarnessPredicate<MatButtonHarness> {\n    return new HarnessPredicate(MatButtonHarness, options).addOption(\n      'text',\n      options.text,\n      (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text),\n    );\n  }\n\n  /**\n   * Clicks the button at the given position relative to its top-left.\n   * @param relativeX The relative x position of the click.\n   * @param relativeY The relative y position of the click.\n   */\n  click(relativeX: number, relativeY: number): Promise<void>;\n  /** Clicks the button at its center. */\n  click(location: 'center'): Promise<void>;\n  /** Clicks the button. */\n  click(): Promise<void>;\n  async click(...args: [] | ['center'] | [number, number]): Promise<void> {\n    return (await this.host()).click(...(args as []));\n  }\n\n  /** Whether the button is disabled. */\n  async isDisabled(): Promise<boolean> {\n    const disabled = (await this.host()).getAttribute('disabled');\n    return coerceBooleanProperty(await disabled);\n  }\n\n  /** Gets the button's label text. */\n  async getText(): Promise<string> {\n    return (await this.host()).text();\n  }\n\n  /** Focuses the button. */\n  async focus(): Promise<void> {\n    return (await this.host()).focus();\n  }\n\n  /** Blurs the button. */\n  async blur(): Promise<void> {\n    return (await this.host()).blur();\n  }\n\n  /** Whether the button is focused. */\n  async isFocused(): Promise<boolean> {\n    return (await this.host()).isFocused();\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-harness';\nexport * from './button-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":";;;;AAYA;AACM,MAAO,gBAAiB,SAAQ,gCAAgC,CAAA;AAMpE;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAAC,OAAA,GAAgC,EAAE,EAAA;AAC5C,QAAA,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS,CAC9D,MAAM,EACN,OAAO,CAAC,IAAI,EACZ,CAAC,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,CAC3E,CAAC;KACH;IAYK,KAAK,CAAC,GAAG,IAAwC,EAAA;;AACrD,YAAA,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,GAAI,IAAW,CAAC,CAAC;SACnD,CAAA,CAAA;AAAA,KAAA;;IAGK,UAAU,GAAA;;AACd,YAAA,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;AAC9D,YAAA,OAAO,qBAAqB,CAAC,MAAM,QAAQ,CAAC,CAAC;SAC9C,CAAA,CAAA;AAAA,KAAA;;IAGK,OAAO,GAAA;;YACX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