Skip to content

Commit 84c4942

Browse files
committed
test: update DropdownMenu tests based on reviewer feedback
1 parent aa1c83d commit 84c4942

1 file changed

Lines changed: 6 additions & 28 deletions

File tree

client/components/Dropdown/DropdownMenu.test.tsx

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,23 @@ describe('DropdownMenu', () => {
1616
);
1717
};
1818

19-
it('should render the dropdown button', () => {
19+
it('should render the dropdown button', () => {
2020
renderDropdown();
2121

2222
const button = screen.getByRole('button', { name: 'More options' });
2323
expect(button).toBeInTheDocument();
24+
25+
expect(screen.queryByRole('menu')).not.toBeInTheDocument();
2426
});
2527

26-
it('should open the dropdown menu when button is clicked', () => {
28+
it('should open dropdown and render menu items when button is clicked', () => {
2729
renderDropdown();
2830

2931
const button = screen.getByRole('button', { name: 'More options' });
3032

3133
fireEvent.click(button);
3234

33-
const menu = screen.getByRole('menu');
34-
expect(menu).toBeInTheDocument();
35-
});
36-
37-
it('should render menu items when opened', () => {
38-
renderDropdown();
39-
40-
const button = screen.getByRole('button', { name: 'More options' });
41-
fireEvent.click(button);
35+
expect(screen.getByRole('menu')).toBeInTheDocument();
4236

4337
expect(screen.getByText('Item One')).toBeInTheDocument();
4438
expect(screen.getByText('Item Two')).toBeInTheDocument();
@@ -59,21 +53,5 @@ describe('DropdownMenu', () => {
5953
});
6054
});
6155

62-
it('should support custom alignment', () => {
63-
render(
64-
<DropdownMenu
65-
aria-label="Aligned dropdown"
66-
align={DropdownMenuAlignment.LEFT}
67-
>
68-
<li role="menuitem">Left Item</li>
69-
</DropdownMenu>
70-
);
71-
72-
const button = screen.getByRole('button', { name: 'Aligned dropdown' });
73-
74-
fireEvent.click(button);
75-
76-
const menu = screen.getByRole('menu');
77-
expect(menu).toBeInTheDocument();
78-
});
56+
7957
});

0 commit comments

Comments
 (0)