Skip to content

Commit 2e9a9f7

Browse files
committed
allow users to specify location of button click
1 parent 306e60d commit 2e9a9f7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/material-experimental/mdc-button/testing/button-harness.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@ export class MatButtonHarness extends ComponentHarness {
3737
(harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
3838
}
3939

40+
/**
41+
* Clicks the button at the given position relative to its top-left.
42+
* @param relativeX The relative x position of the click.
43+
* @param relativeY The relative y position of the click.
44+
*/
45+
click(relativeX: number, relativeY: number): Promise<void>;
46+
/** Clicks the button at its center. */
47+
click(location: 'center'): Promise<void>;
4048
/** Clicks the button. */
41-
async click(): Promise<void> {
42-
return (await this.host()).click();
49+
click(): Promise<void>;
50+
async click(...args: ['center'] | [number, number]): Promise<void> {
51+
return (await this.host()).click(...(args as [any]));
4352
}
4453

4554
/** Gets a boolean promise indicating if the button is disabled. */

0 commit comments

Comments
 (0)