fix(a11y): describe protected administrator actions without replacing names

This commit is contained in:
cesnimda
2026-10-21 07:23:03 +02:00
parent b39a5af4de
commit 44458f4f3a
5 changed files with 232 additions and 5 deletions
+5 -1
View File
@@ -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();
});