mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 06:49:40 +02:00
feat(ui/buttons): introduce Add and Delete buttons [EE-6296] (#10585)
This commit is contained in:
parent
66635ba6b1
commit
1f2f4525e3
6 changed files with 108 additions and 47 deletions
|
@ -1,22 +1,18 @@
|
|||
import { fireEvent, render } from '@testing-library/react';
|
||||
import { render } from '@/react-tools/test-utils';
|
||||
|
||||
import { AddButton, Props } from './AddButton';
|
||||
import { AddButton } from './AddButton';
|
||||
|
||||
function renderDefault({
|
||||
label = 'default label',
|
||||
onClick = () => {},
|
||||
}: Partial<Props> = {}) {
|
||||
return render(<AddButton label={label} onClick={onClick} />);
|
||||
}: Partial<{ label: string }> = {}) {
|
||||
return render(<AddButton to="">{label}</AddButton>);
|
||||
}
|
||||
|
||||
test('should display a AddButton component and allow onClick', async () => {
|
||||
test('should display a AddButton component', async () => {
|
||||
const label = 'test label';
|
||||
const onClick = jest.fn();
|
||||
const { findByText } = renderDefault({ label, onClick });
|
||||
|
||||
const { findByText } = renderDefault({ label });
|
||||
|
||||
const buttonLabel = await findByText(label);
|
||||
expect(buttonLabel).toBeTruthy();
|
||||
|
||||
fireEvent.click(buttonLabel);
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue