Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ng-dev] Feature request: getIconButtonHarness() #107

Closed
ersimont opened this issue Jun 19, 2023 · 0 comments
Closed

[ng-dev] Feature request: getIconButtonHarness() #107

ersimont opened this issue Jun 19, 2023 · 0 comments

Comments

@ersimont
Copy link
Member

ersimont commented Jun 19, 2023

export async function getIconButtonHarness(
  iconName: string,
  parent: ContentContainerComponentHarness,
): Promise<MatButtonHarness> {
  const buttons = await parent.getAllHarnesses(MatButtonHarness);
  for (const button of buttons) {
    const icons = await button.getAllHarnesses(
      MatIconHarness.with({ name: iconName }),
    );
    if (icons.length) {
      return button;
    }
  }
  throw new Error('No button found with icon ' + iconName);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant