ghost-portal/packages/page-bounties/test/utils/clickButtonWithName.ts
2021-02-25 07:55:48 +01:00

11 lines
396 B
TypeScript

// Copyright 2017-2021 @polkadot/app-bounties authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { fireEvent } from '@testing-library/react';
export const clickButtonWithName = async (buttonName: string, findByRole: (...args: any[]) => Promise<HTMLElement>): Promise<void> => {
const button = await findByRole('button', { name: buttonName });
fireEvent.click(button);
};