Merge branch 'main' into feature/278_membership_fee_settings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Moritz 2025-12-16 15:12:51 +01:00
commit 651f518215
Signed by: moritz
GPG key ID: 1020A035E5DD0824
19 changed files with 278 additions and 156 deletions

View file

@ -52,14 +52,11 @@ defmodule MvWeb.MemberLive.IndexCustomFieldsAccessibilityTest do
field: field
} do
conn = conn_with_oidc_user(conn)
{:ok, _view, html} = live(conn, "/members")
{:ok, view, _html} = live(conn, "/members")
# Check that the sort button has aria-label
assert html =~ ~r/aria-label=["']Click to sort["']/i or
html =~ ~r/aria-label=["'].*sort.*["']/i
# Check that data-testid is present for testing
assert html =~ ~r/data-testid=["']custom_field_#{field.id}["']/
# Check that the sort button has aria-label and data-testid
test_id = "custom_field_#{field.id}"
assert has_element?(view, "[data-testid='#{test_id}'][aria-label='Click to sort']")
end
test "sort header component shows correct ARIA label when sorted ascending", %{
@ -71,10 +68,9 @@ defmodule MvWeb.MemberLive.IndexCustomFieldsAccessibilityTest do
{:ok, view, _html} =
live(conn, "/members?query=&sort_field=custom_field_#{field.id}&sort_order=asc")
html = render(view)
# Check that aria-label indicates ascending sort
assert html =~ ~r/aria-label=["'].*ascending.*["']/i
# Check that aria-label indicates ascending sort using data-testid
test_id = "custom_field_#{field.id}"
assert has_element?(view, "[data-testid='#{test_id}'][aria-label='ascending']")
end
test "sort header component shows correct ARIA label when sorted descending", %{
@ -86,21 +82,21 @@ defmodule MvWeb.MemberLive.IndexCustomFieldsAccessibilityTest do
{:ok, view, _html} =
live(conn, "/members?query=&sort_field=custom_field_#{field.id}&sort_order=desc")
html = render(view)
# Check that aria-label indicates descending sort
assert html =~ ~r/aria-label=["'].*descending.*["']/i
# Check that aria-label indicates descending sort using data-testid
test_id = "custom_field_#{field.id}"
assert has_element?(view, "[data-testid='#{test_id}'][aria-label='descending']")
end
test "custom field column header is keyboard accessible", %{conn: conn, field: field} do
conn = conn_with_oidc_user(conn)
{:ok, _view, html} = live(conn, "/members")
{:ok, view, _html} = live(conn, "/members")
# Check that the sort button is a button element (keyboard accessible)
assert html =~ ~r/<button[^>]*data-testid=["']custom_field_#{field.id}["']/
test_id = "custom_field_#{field.id}"
assert has_element?(view, "button[data-testid='#{test_id}']")
# Button should not have tabindex="-1" (which would remove from tab order)
refute html =~ ~r/tabindex=["']-1["']/
refute has_element?(view, "button[data-testid='#{test_id}'][tabindex='-1']")
end
test "custom field column header has proper semantic structure", %{conn: conn, field: field} do

View file

@ -410,15 +410,17 @@ defmodule MvWeb.MemberLive.IndexTest do
assert render(view) =~ "1"
end
test "copy button is not visible when no members are selected", %{conn: conn} do
test "copy button is disabled when no members selected", %{conn: conn} do
conn = conn_with_oidc_user(conn)
{:ok, view, _html} = live(conn, "/members")
# Ensure no members are selected (default state)
refute has_element?(view, "#copy-emails-btn")
# Copy button should be disabled (button element)
assert has_element?(view, "#copy-emails-btn[disabled]")
# Open email button should be disabled (link with tabindex and aria-disabled)
assert has_element?(view, "#open-email-btn[tabindex='-1'][aria-disabled='true']")
end
test "copy button is visible when members are selected", %{
test "copy button is enabled after selection", %{
conn: conn,
member1: member1
} do
@ -428,8 +430,13 @@ defmodule MvWeb.MemberLive.IndexTest do
# Select a member by sending the select_member event directly
render_click(view, "select_member", %{"id" => member1.id})
# Button should now be visible
assert has_element?(view, "#copy-emails-btn")
# Copy button should now be enabled (no disabled attribute)
refute has_element?(view, "#copy-emails-btn[disabled]")
# Open email button should now be enabled (no tabindex=-1 or aria-disabled)
refute has_element?(view, "#open-email-btn[tabindex='-1']")
refute has_element?(view, "#open-email-btn[aria-disabled='true']")
# Counter should show correct count
assert render(view) =~ "1"
end
test "copy button click triggers event and shows flash", %{