Move shlink-frontend-kit tests to its own dir

This commit is contained in:
Alejandro Celaya
2023-08-02 08:15:50 +02:00
parent 99ce8c9f74
commit b7d57a53f2
17 changed files with 43 additions and 32 deletions

View File

@@ -0,0 +1,28 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import type { DropdownBtnMenuProps } from '../../src';
import { RowDropdownBtn } from '../../src';
import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<RowDropdownBtn />', () => {
const setUp = (props: Partial<DropdownBtnMenuProps> = {}) => renderWithEvents(
<RowDropdownBtn {...fromPartial<DropdownBtnMenuProps>({ ...props })}>
the children
</RowDropdownBtn>,
);
it('renders expected components', () => {
setUp();
const toggle = screen.getByRole('button');
expect(toggle).toBeInTheDocument();
expect(toggle).toHaveClass('btn-sm');
expect(toggle).toHaveClass('dropdown-btn__toggle');
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
});
it('renders expected children', () => {
setUp();
expect(screen.getByText('the children')).toBeInTheDocument();
});
});