feat(overview): add point-in-time, suspended, OR-group and count-range filters
This commit is contained in:
parent
c547ca19af
commit
c0d1550401
23 changed files with 1116 additions and 117 deletions
|
|
@ -1,8 +1,8 @@
|
|||
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.
|
||||
§1.25 (supersedes §1.8) — a date field's value control offers relative
|
||||
presets; picking "This year" applies the period-to-date range (Jan 1 – today)
|
||||
of the current year and writes the equivalent range params to the URL.
|
||||
"""
|
||||
use MvWeb.ConnCase, async: false
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ defmodule MvWeb.MemberLive.IndexDatePresetsTest do
|
|||
%{conn: conn_with_oidc_user(conn)}
|
||||
end
|
||||
|
||||
test "the 'This year' preset applies the current-year range and writes URL params", %{
|
||||
test "the 'This year' preset applies the year-to-date range and writes URL params", %{
|
||||
conn: conn
|
||||
} do
|
||||
{:ok, view, _html} = live(conn, ~p"/members")
|
||||
|
|
@ -32,8 +32,20 @@ defmodule MvWeb.MemberLive.IndexDatePresetsTest do
|
|||
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"
|
||||
today = Date.utc_today()
|
||||
assert path =~ "jd_from=#{today.year}-01-01"
|
||||
assert path =~ "jd_to=#{Date.to_iso8601(today)}"
|
||||
end
|
||||
|
||||
test "the 'Last 30 days' preset applies a today-anchored 30-day window", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, ~p"/members")
|
||||
|
||||
pick_field(view, "join_date")
|
||||
view |> element("[data-testid='date-preset-last_30_days']") |> render_click()
|
||||
|
||||
path = assert_patch(view)
|
||||
today = Date.utc_today()
|
||||
assert path =~ "jd_from=#{Date.to_iso8601(Date.add(today, -29))}"
|
||||
assert path =~ "jd_to=#{Date.to_iso8601(today)}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue