fix(a11y): describe protected administrator actions without replacing names
This commit is contained in:
@@ -115,7 +115,11 @@ test("warns before demoting another administrator", async () => {
|
||||
test("disables demotion and deletion for the final administrator", async () => {
|
||||
renderPage([{ id: "me", email: "me@example.com", userName: "me", roles: ["Admin"], emailConfirmed: true, isCurrentUser: true, canRemoveAdmin: false }]);
|
||||
|
||||
expect(await screen.findByRole("button", { name: "Remove admin" })).toBeDisabled();
|
||||
const demote = await screen.findByRole("button", { name: "Remove admin" });
|
||||
expect(demote).toBeDisabled();
|
||||
expect(demote.parentElement).not.toHaveAttribute("aria-label");
|
||||
fireEvent.mouseOver(demote.parentElement!);
|
||||
expect(await screen.findByRole("tooltip")).toHaveTextContent("The final administrator cannot be demoted or deleted.");
|
||||
expect(screen.getByRole("button", { name: "Delete" })).toBeDisabled();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user