Swaps the unbounded vertical filter panel for a Polaris-style add-filter builder (searchable grouped field picker, type-aware value control, applied chips) and colour-codes the fees column with each member's period-scoped unpaid-cycle count.
39 lines
1.2 KiB
Elixir
39 lines
1.2 KiB
Elixir
defmodule MvWeb.MemberLive.IndexDatePresetsTest do
|
||
@moduledoc """
|
||
§1.8 — a date field's value control offers presets; picking "This year"
|
||
applies the Jan 1 – Dec 31 range of the current year and writes the equivalent
|
||
range params to the URL.
|
||
"""
|
||
use MvWeb.ConnCase, async: false
|
||
|
||
import Phoenix.LiveViewTest
|
||
|
||
setup %{conn: conn} do
|
||
actor = Mv.Helpers.SystemActor.get_system_actor()
|
||
|
||
{:ok, _member} =
|
||
Mv.Membership.create_member(
|
||
%{first_name: "Preset", last_name: "Member", email: "preset@example.com"},
|
||
actor: actor
|
||
)
|
||
|
||
%{conn: conn_with_oidc_user(conn)}
|
||
end
|
||
|
||
test "the 'This year' preset applies the current-year range and writes URL params", %{
|
||
conn: conn
|
||
} do
|
||
{:ok, view, _html} = live(conn, ~p"/members")
|
||
|
||
# Open the Join date value control and apply the "This year" preset.
|
||
pick_field(view, "join_date")
|
||
assert has_element?(view, "[data-testid='date-presets']")
|
||
|
||
view |> element("[data-testid='date-preset-this_year']") |> render_click()
|
||
|
||
path = assert_patch(view)
|
||
year = Date.utc_today().year
|
||
assert path =~ "jd_from=#{year}-01-01"
|
||
assert path =~ "jd_to=#{year}-12-31"
|
||
end
|
||
end
|