format and linting: reduced complexity of function
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bb362e1636
commit
8104451d35
2 changed files with 44 additions and 40 deletions
|
|
@ -47,7 +47,7 @@ defmodule MvWeb.Components.SortHeaderComponentTest do
|
|||
describe "sort icons" do
|
||||
test "shows neutral icon for specific field when not sorted", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, view, html} = live(conn, "/members")
|
||||
{:ok, view, _html} = live(conn, "/members")
|
||||
|
||||
# The neutral icon has the opcity class we can test for
|
||||
# Test that EMAIL field specifically shows neutral icon
|
||||
|
|
@ -68,23 +68,23 @@ defmodule MvWeb.Components.SortHeaderComponentTest do
|
|||
# Test that OTHER fields still show neutral icons
|
||||
assert has_element?(view, "[data-testid='first_name'] .opacity-40")
|
||||
|
||||
# Test HTML content - should contain chevron-up AND chevron-up-down
|
||||
# Test HTML content - should contain chevronup AND chevron up down
|
||||
assert html =~ "hero-chevron-up"
|
||||
assert html =~ "hero-chevron-up-down"
|
||||
|
||||
# Count occurrences to ensure only one ascending icon
|
||||
up_count = html |> String.split("hero-chevron-up ") |> length() |> Kernel.-(1)
|
||||
# Should be exactly one chevron-up icon
|
||||
# Should be exactly one chevronup icon
|
||||
assert up_count == 1
|
||||
end
|
||||
|
||||
test "shows descending icon for specific field when sorted descending", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, view, html} = live(conn, "/members?query=&sort_field=email&sort_order=desc")
|
||||
{:ok, _view, html} = live(conn, "/members?query=&sort_field=email&sort_order=desc")
|
||||
|
||||
# Count occurrences to ensure only one descending icon
|
||||
down_count = html |> String.split("hero-chevron-down ") |> length() |> Kernel.-(1)
|
||||
# Should be exactly one chevron-down icon
|
||||
# Should be exactly one chevrondown icon
|
||||
assert down_count == 1
|
||||
end
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ defmodule MvWeb.Components.SortHeaderComponentTest do
|
|||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, view, _html} = live(conn, "/members")
|
||||
|
||||
# Click on the first_name sort header
|
||||
# Click on the first name sort header
|
||||
view
|
||||
|> element("button[phx-value-field='first_name']")
|
||||
|> render_click()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue