Fix merge conflicts

This commit is contained in:
Alejandro Celaya
2023-05-27 12:04:01 +02:00
21 changed files with 114 additions and 111 deletions

View File

@@ -26,9 +26,8 @@ describe('<DomainSelector />', () => {
const btn = screen.getByRole('button', { name: expectedText });
expect(screen.queryByPlaceholderText('Domain')).not.toBeInTheDocument();
expect(btn).toHaveAttribute(
'class',
`dropdown-btn__toggle btn-block ${expectedClassName} dropdown-toggle btn btn-primary`,
expect(btn).toHaveClass(
`dropdown-btn__toggle ${expectedClassName} btn-block dropdown-btn__toggle--with-caret dropdown-toggle btn btn-primary`,
);
await user.click(btn);

View File

@@ -1,42 +0,0 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import type { DropdownBtnMenuProps } from '../../src/utils/DropdownBtnMenu';
import { DropdownBtnMenu } from '../../src/utils/DropdownBtnMenu';
import { renderWithEvents } from '../__helpers__/setUpTest';
describe('<DropdownBtnMenu />', () => {
const setUp = (props: Partial<DropdownBtnMenuProps> = {}) => renderWithEvents(
<DropdownBtnMenu {...fromPartial<DropdownBtnMenuProps>({ toggle: vi.fn(), ...props })}>
the children
</DropdownBtnMenu>,
);
it('renders expected components', () => {
setUp();
const toggle = screen.getByRole('button');
expect(toggle).toBeInTheDocument();
expect(toggle).toHaveClass('btn-sm');
expect(toggle).toHaveClass('dropdown-btn-menu__dropdown-toggle');
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
});
it('renders expected children', () => {
setUp();
expect(screen.getByText('the children')).toBeInTheDocument();
});
it.each([
[undefined, true],
[true, true],
[false, false],
])('renders menu to the end when expected', (right, expectedEnd) => {
setUp({ right });
if (expectedEnd) {
expect(screen.getByRole('menu', { hidden: true })).toHaveClass('dropdown-menu-end');
} else {
expect(screen.getByRole('menu', { hidden: true })).not.toHaveClass('dropdown-menu-end');
}
});
});

View File

@@ -0,0 +1,28 @@
import { screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import type { DropdownBtnMenuProps } from '../../src/utils/RowDropdownBtn';
import { RowDropdownBtn } from '../../src/utils/RowDropdownBtn';
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();
});
});