Skip to content

chore: replace MoreMenu with DropdownMenu #17615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 1, 2025
Prev Previous commit
Next Next commit
fix: update tests
  • Loading branch information
jaaydenh committed May 1, 2025
commit bb25e431773db867fa6d16113a6c792cbc56d852
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ const renderPage = async () => {
const removeMember = async () => {
const user = userEvent.setup();
// Click on the "Open menu" button to display the "Remove" option
const menuButtons = await screen.findAllByLabelText("Open menu");
const menuButtons = await screen.findAllByRole("button", { name: "Open menu" });
// get MockUser2
const selectedMenuButton = menuButtons[0];

await user.click(selectedMenuButton);

const removeButton = await within(document.body).findByText("Remove…");
// Wait for the dropdown menu to be visible and find the remove button
const menuItems = await screen.findAllByRole("menuitem");
const removeButton = menuItems.find(item => item.textContent === "Remove");
if (!removeButton) {
throw new Error("Remove button not found");
}
await user.click(removeButton);

const dialog = await within(document.body).findByRole("dialog");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ export const OpenDownloadLogs: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button", { name: "More options" }));
await userEvent.click(canvas.getByText("Download logs", { exact: false }));
await userEvent.click(canvas.getByRole("button", { name: "Workspace actions" }));
const screen = within(document.body);
await userEvent.click(screen.getByText("Download logs…"));
await expect(screen.getByTestId("dialog")).toBeInTheDocument();
},
};
Expand All @@ -215,8 +215,9 @@ export const CanDeleteDormantWorkspace: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button", { name: "More options" }));
const deleteButton = canvas.getByText("Delete…");
await userEvent.click(canvas.getByRole("button", { name: "Workspace actions" }));
const screen = within(document.body);
const deleteButton = screen.getByText("Delete…");
await expect(deleteButton).toBeEnabled();
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
<Button
size="icon-lg"
variant="subtle"
aria-label="More options"
aria-label="Workspace actions"
data-testid="workspace-options-button"
aria-controls="workspace-options"
disabled={!canAcceptJobs}
>
<EllipsisVertical aria-hidden="true" />
<span className="sr-only">More options</span>
<span className="sr-only">Workspace actions</span>
</Button>
</DropdownMenuTrigger>

Expand Down