@angular/material
Version:
Angular Material
1 lines • 5.09 kB
Source Map (JSON)
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/button/testing/button-harness.ts","../../../../../../../src/material/button/testing/button-harness-filters.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\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatButtonHarness` instances. */\nexport interface ButtonHarnessFilters extends BaseHarnessFilters {\n /** Only find instances whose text matches the given value. */\n text?: string | RegExp;\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":";;;AAAA;;;;;;;AAYA;MACa,gBAAiB,SAAQ,gCAAgC;;;;;;;IAYpE,OAAO,IAAI,CAAC,UAAgC,EAAE;QAC5C,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;IAYD,MAAM,KAAK,CAAC,GAAG,IAAwC;QACrD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,GAAI,IAAW,CAAC,CAAC;KACnD;;IAGD,MAAM,UAAU;QACd,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;QAC9D,OAAO,qBAAqB,CAAC,MAAM,QAAQ,CAAC,CAAC;KAC9C;;IAGD,MAAM,OAAO;QACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;KACnC;;IAGD,MAAM,KAAK;QACT,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC;KACpC;;IAGD,MAAM,IAAI;QACR,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;KACnC;;IAGD,MAAM,SAAS;QACb,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC;KACxC;;AAzDD;AACA;AACO,6BAAY,GAAG;yEACiD;;ACjBzE;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;;;"}