Rework member overview #553

Open
simon wants to merge 27 commits from issue/mitgliederverwaltung-547 into main
2 changed files with 13 additions and 6 deletions
Showing only changes of commit f847ae10af - Show all commits

View file

@ -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

View file

@ -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