1 | {"version":3,"file":"button__testing.js","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\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)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));\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;;;;;;;AAaA;MACa,gBAAiB,SAAQ,gCAAgC;;;;;;;IAYpE,OAAO,IAAI,CAAC,UAAgC,EAAE;QAC5C,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,OAAO,CAAC;aACjD,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,CAAC;KACrF;IAYK,KAAK,CAAC,GAAG,IAAwC;;YACrD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,GAAI,IAAW,CAAC,CAAC;SACnD;KAAA;;IAGK,UAAU;;YACd,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;YAC9D,OAAO,qBAAqB,CAAC,MAAM,QAAQ,CAAC,CAAC;SAC9C;KAAA;;IAGK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;SACnC;KAAA;;IAGK,KAAK;;YACT,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC;SACpC;KAAA;;IAGK,IAAI;;YACR,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;SACnC;KAAA;;IAGK,SAAS;;YACb,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC;SACxC;KAAA;;AAvDD;AACA;AACO,6BAAY,GAAG;yEACiD;;AClBzE;;;;;;;;ACAA;;;;;;;;ACAA;;;;;;;;;;"} |
---|