Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/lib/components/Dropdown/Dropdown.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,24 @@ describe('Components / Dropdown', () => {
expect(dropdown()).not.toHaveClass('invisible');
});
});
describe('Type of button', async () => {
it('should be of type `button`', async () => {
render(<TestDropdown />);
expect(button()).toHaveAttribute('type', 'button');
});

it('should be of type `button` with inline', async () => {
render(<TestDropdown inline />);
expect(button()).toHaveAttribute('type', 'button');
});
});
});

const TestDropdown: FC<{ dismissOnClick?: boolean }> = ({ dismissOnClick = true }) => (
<Dropdown label="Dropdown button" placement="right" dismissOnClick={dismissOnClick}>
const TestDropdown: FC<{ dismissOnClick?: boolean; inline?: boolean }> = ({
dismissOnClick = true,
inline = false,
}) => (
<Dropdown label="Dropdown button" placement="right" dismissOnClick={dismissOnClick} inline={inline}>
<Dropdown.Header>
<span className="block text-sm">Bonnie Green</span>
<span className="block truncate text-sm font-medium">[email protected]</span>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ const DropdownComponent: FC<DropdownProps> = ({
}, [ref]);

return inline ? (
<button ref={ref} className={theme.inlineWrapper}>
<button type="button" ref={ref} className={theme.inlineWrapper}>
{children}
</button>
) : (
<Button ref={ref} {...buttonProps}>
<Button type="button" ref={ref} {...buttonProps}>
{children}
</Button>
);
Expand Down