diff --git a/lib/mv_web/components/table_components.ex b/lib/mv_web/components/table_components.ex index ed94994..6b3c060 100644 --- a/lib/mv_web/components/table_components.ex +++ b/lib/mv_web/components/table_components.ex @@ -20,7 +20,6 @@ defmodule MvWeb.TableComponents do type="button" phx-click="sort" phx-value-field={@field} - aria-sort={aria_sort(@sort_field, @sort_order, @field)} class="flex items-center gap-1 hover:underline focus:outline-none" > {@label} @@ -33,12 +32,4 @@ defmodule MvWeb.TableComponents do """ end - - defp aria_sort(current_field, current_order, this_field) do - cond do - current_field != this_field -> "none" - current_order == :asc -> "ascending" - true -> "descending" - end - end end diff --git a/test/mv_web/user_live/index_test.exs b/test/mv_web/user_live/index_test.exs index cf1cc80..11cd70b 100644 --- a/test/mv_web/user_live/index_test.exs +++ b/test/mv_web/user_live/index_test.exs @@ -55,7 +55,6 @@ defmodule MvWeb.UserLive.IndexTest do # Should show ascending indicator (up arrow) assert html =~ "hero-chevron-up" - assert html =~ ~s(aria-sort="ascending") # Test actual sort order: alpha should appear before mike, mike before zulu alpha_pos = html |> :binary.match("alpha@example.com") |> elem(0) @@ -76,7 +75,6 @@ defmodule MvWeb.UserLive.IndexTest do # Should now show descending indicator (down arrow) assert html =~ "hero-chevron-down" - assert html =~ ~s(aria-sort="descending") # Test actual sort order reversed: zulu should now appear before mike, mike before alpha alpha_pos = html |> :binary.match("alpha@example.com") |> elem(0) @@ -107,7 +105,6 @@ defmodule MvWeb.UserLive.IndexTest do # Click again to toggle back to ascending html = view |> element("button[phx-value-field='email']") |> render_click() assert html =~ "hero-chevron-up" - assert html =~ ~s(aria-sort="ascending") # Should be back to original ascending order alpha_pos = html |> :binary.match("alpha@example.com") |> elem(0) @@ -379,6 +376,45 @@ defmodule MvWeb.UserLive.IndexTest do end end + describe "Password column display" do + test "user without password shows em dash 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(%{ + email: "no-password@example.com", + hashed_password: nil + }) + + conn = conn_with_oidc_user(conn) + {:ok, view, html} = live(conn, "/users") + + assert html =~ "no-password@example.com" + + # Password column must show "—" (em dash) for user without password, not "Enabled" + row = view |> element("tr#row-#{user_no_pw.id}") |> render() + assert row =~ "—", "Password column should show em dash for user without password" + + refute row =~ "Enabled", + "Password column must not show Enabled when user has no password" + end + + test "user with password shows Enabled in Password column", %{conn: conn} do + user_with_pw = + create_test_user(%{ + email: "with-password@example.com", + password: "test123" + }) + + conn = conn_with_oidc_user(conn) + {:ok, view, html} = live(conn, "/users") + + assert html =~ "with-password@example.com" + + row = view |> element("tr#row-#{user_with_pw.id}") |> render() + assert row =~ "Enabled", "Password column should show Enabled when user has password" + end + end + describe "member linking display" do @tag :slow test "displays linked member name in user list", %{conn: conn} do