refactor: cleanup dropdown_menu component (required attr, remove redundant defaults, fix checkbox)

This commit is contained in:
Moritz 2025-12-03 18:42:49 +01:00
parent 6cf955b024
commit 6029920c3f
2 changed files with 10 additions and 51 deletions

View file

@ -420,7 +420,7 @@ defmodule MvWeb.MemberLive.IndexFieldVisibilityTest do
assert html =~ ~s(tabindex="0")
# Check that keyboard events are supported
assert html =~ ~s(phx-keydown="select_item")
assert html =~ ~s(phx-key="Enter Space")
assert html =~ ~s(phx-key="Enter")
end
test "keyboard activation with Enter key works", %{conn: conn} do
@ -448,31 +448,5 @@ defmodule MvWeb.MemberLive.IndexFieldVisibilityTest do
html = render(view)
refute html =~ "alice@example.com"
end
test "keyboard activation with Space key works", %{conn: conn} do
conn = conn_with_oidc_user(conn)
{:ok, view, _html} = live(conn, "/members")
# Verify email is visible initially
html = render(view)
assert html =~ "alice@example.com"
# Open dropdown
view
|> element("button[aria-controls='field-visibility-menu']")
|> render_click()
# Simulate Space key press on email field button
view
|> element("button[phx-click='select_item'][phx-value-item='email']")
|> render_keydown(%{key: " "})
# Wait for update
:timer.sleep(100)
# Email should no longer be visible
html = render(view)
refute html =~ "alice@example.com"
end
end
end