feat: keep empty cells consistent empty
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
carla 2026-02-26 13:37:35 +01:00
parent 9751525a0c
commit 4ac56958b4
18 changed files with 263 additions and 372 deletions

View file

@ -76,7 +76,7 @@ defmodule MvWeb.CustomFieldLive.DeletionTest do
refute has_element?(view, "h2", "Custom fields")
# Should show correct member count (1 member)
assert render(view) =~ "1 member has a value assigned for this custom field"
assert render(view) =~ "1 member has a value assigned for this datafield"
# Should show the slug
assert render(view) =~ custom_field.slug
@ -95,7 +95,7 @@ defmodule MvWeb.CustomFieldLive.DeletionTest do
open_delete_modal(view, custom_field)
# Should show plural form
assert render(view) =~ "2 members have values assigned for this custom field"
assert render(view) =~ "2 members have values assigned for this datafield"
end
test "shows 0 members for custom field without values", %{conn: conn} do
@ -105,7 +105,7 @@ defmodule MvWeb.CustomFieldLive.DeletionTest do
open_delete_modal(view, custom_field)
# Should show 0 members
assert render(view) =~ "0 members have values assigned for this custom field"
assert render(view) =~ "0 members have values assigned for this datafield"
end
end

View file

@ -95,6 +95,20 @@ defmodule MvWeb.MemberLive.IndexGroupsDisplayTest do
assert html =~ member3.first_name
end
test "empty group cell is visually empty with sr-only text (no dash)", %{
conn: conn,
member3: member3
} do
conn = conn_with_oidc_user(conn)
{:ok, _view, html} = live(conn, "/members")
assert html =~ member3.first_name
# Screen reader gets a meaningful label for the empty cell
assert html =~ "sr-only"
assert html =~ "No group assignment"
# No visible dash as placeholder (Design Guidelines §8.6)
refute html =~ ~r/<span[^>]*class="[^"]*text-base-content\/50[^"]*"[^>]*>—<\/span>/
end
test "displays group name correctly in badge", %{conn: conn, group1: group1} do
conn = conn_with_oidc_user(conn)
{:ok, _view, html} = live(conn, "/members")

View file

@ -210,7 +210,9 @@ defmodule MvWeb.UserLive.IndexTest do
end
describe "Password column display" do
test "user without password shows em dash in Password column", %{conn: conn} do
test "user without password shows empty cell with sr-only text in Password column", %{
conn: conn
} do
# User created with hashed_password: nil (no password) - must not get default password
user_no_pw =
create_test_user(%{
@ -223,9 +225,13 @@ defmodule MvWeb.UserLive.IndexTest do
assert html =~ "no-password@example.com"
# Password column must show "—" (em dash) for user without password, not "Enabled"
# Password column: visually empty, screen-reader gets "Not set" (Design Guidelines §8.6)
row = view |> element("tr#row-#{user_no_pw.id}") |> render()
assert row =~ "", "Password column should show em dash for user without password"
assert row =~ "sr-only", "Password column should have sr-only text for accessibility"
assert row =~ "Not set", "Screen reader should get 'Not set' for empty password"
refute row =~ "",
"Password column must not show dash (use empty cell + sr-only per CODE_GUIDELINES §8)"
refute row =~ "Enabled",
"Password column must not show Enabled when user has no password"