test: add more filter component tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Simon 2026-01-21 01:14:26 +01:00
parent f996aee6b2
commit 4b67039a78
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
2 changed files with 114 additions and 0 deletions

View file

@ -263,5 +263,38 @@ defmodule MvWeb.Components.MemberFilterComponentTest do
# (String fields should not appear in boolean filter section)
refute dropdown_html =~ "String Field"
end
test "dropdown shows scrollbar when many boolean custom fields exist", %{conn: conn} do
conn = conn_with_oidc_user(conn)
# Create 15 boolean custom fields (more than typical, should trigger scrollbar)
boolean_fields =
Enum.map(1..15, fn i ->
create_boolean_custom_field(%{name: "Field #{i}"})
end)
{:ok, view, _html} = live(conn, "/members")
# Open dropdown
view
|> element("#member-filter button[aria-haspopup='true']")
|> render_click()
# Extract dropdown panel HTML
dropdown_html =
view
|> element("#member-filter div[role='dialog']")
|> render()
# Should have scrollbar classes: max-h-60 overflow-y-auto pr-2
# Check for the scrollable container (the div with max-h-60 and overflow-y-auto)
assert dropdown_html =~ "max-h-60"
assert dropdown_html =~ "overflow-y-auto"
# Verify all fields are present in the dropdown
Enum.each(boolean_fields, fn field ->
assert dropdown_html =~ field.name
end)
end
end
end