diff --git a/test/mv_web/components/field_visibility_dropdown_component_test.exs b/test/mv_web/components/field_visibility_dropdown_component_test.exs index 4bd04b07..c0a40600 100644 --- a/test/mv_web/components/field_visibility_dropdown_component_test.exs +++ b/test/mv_web/components/field_visibility_dropdown_component_test.exs @@ -4,7 +4,13 @@ defmodule MvWeb.Components.FieldVisibilityDropdownComponentTest do describe "field visibility dropdown in member view" do test "renders and toggles visibility", %{conn: conn} do - conn = conn_with_oidc_user(conn) + # Email is folded into the Member cell by default; unfold it so it appears + # as its own togglable column in the dropdown. + conn = + conn + |> conn_with_oidc_user() + |> Plug.Conn.put_session("member_view_settings", ~s({"member_include_email":false})) + {:ok, view, _html} = live(conn, ~p"/members") # Renders Dropdown diff --git a/test/mv_web/components/sort_header_component_test.exs b/test/mv_web/components/sort_header_component_test.exs index 2ae3ce01..65b4c307 100644 --- a/test/mv_web/components/sort_header_component_test.exs +++ b/test/mv_web/components/sort_header_component_test.exs @@ -7,7 +7,7 @@ defmodule MvWeb.Components.SortHeaderComponentTest do # The individual name/address constituents are only *offered* when the compact # Member / Address view settings are off, so the session opts them out of the # composite columns before selecting the fields via ?fields=. - @cols "first_name,email,street,house_number,postal_code,city,country,join_date" + @cols "first_name,last_name,email,street,house_number,postal_code,city,country,join_date" # Disables the compact Member/Address composites so first_name/last_name/email # and street/house_number/postal_code/city are offered as individual sortable @@ -135,9 +135,10 @@ defmodule MvWeb.Components.SortHeaderComponentTest do conn = conn |> conn_with_oidc_user() |> non_compact() {:ok, view, _html} = live(conn, "/members?fields=#{@cols}") - # Start: all fields neutral except first name as default + # Start: all fields neutral except the default sort field (last name) assert has_element?(view, "[data-testid='city'] .opacity-40") - refute has_element?(view, "[data-testid='first_name'] .opacity-40") + refute has_element?(view, "[data-testid='last_name'] .opacity-40") + assert has_element?(view, "[data-testid='first_name'] .opacity-40") assert has_element?(view, "[data-testid='email'] .opacity-40") # Click city - should become active @@ -304,9 +305,9 @@ defmodule MvWeb.Components.SortHeaderComponentTest do {:ok, view, html} = live(conn, "/members?fields=#{@cols}&sort_field=invalid_field&sort_order=asc") - # Should not crash and should default sorting for first name + # Should not crash and should fall back to the default sort (last name) assert html =~ "hero-chevron-up-down" - refute has_element?(view, "[data-testid='first_name'] .opacity-40") + refute has_element?(view, "[data-testid='last_name'] .opacity-40") end test "handles invalid sort order gracefully", %{conn: conn} do