Fixed da tests

This commit is contained in:
Kieran Eglin 2024-12-13 09:37:39 -08:00
parent e43fbd2888
commit ba5803d756
No known key found for this signature in database
GPG key ID: 193984967FCF432D
2 changed files with 10 additions and 10 deletions

View file

@ -41,12 +41,12 @@ defmodule PinchflatWeb.CustomComponents.TableComponents do
phx-value-sort_key={col[:sort_key]}
>
<div class="relative">
{col[:label]}
<.icon
:if={to_string(@sort_key) == col[:sort_key]}
name={if @sort_direction == :asc, do: "hero-chevron-up", else: "hero-chevron-down"}
class="w-3 h-3 mt-2 ml-1 absolute"
/>
{col[:label]}
<.icon
:if={to_string(@sort_key) == col[:sort_key]}
name={if @sort_direction == :asc, do: "hero-chevron-up", else: "hero-chevron-down"}
class="w-3 h-3 mt-2 ml-1 absolute"
/>
</div>
</th>
</tr>

View file

@ -59,19 +59,19 @@ defmodule PinchflatWeb.Sources.SourceLive.IndexTableLiveTest do
end
test "clicking a different row will sort by that attribute", %{conn: conn} do
source1 = source_fixture(custom_name: "Source_A", retention_period_days: 10)
source2 = source_fixture(custom_name: "Source_A", retention_period_days: 5)
source1 = source_fixture(custom_name: "Source_A", enabled: true)
source2 = source_fixture(custom_name: "Source_A", enabled: false)
{:ok, view, _html} = live_isolated(conn, IndexTableLive, session: create_session())
# Click the row to change the sort field
click_element(view, "th", "Retention")
click_element(view, "th", "Enabled?")
assert render_element(view, "tbody tr:first-child") =~ source2.custom_name
assert render_element(view, "tbody tr:last-child") =~ source1.custom_name
# Click the row to again change the sort direcation
click_element(view, "th", "Retention")
click_element(view, "th", "Enabled?")
assert render_element(view, "tbody tr:first-child") =~ source1.custom_name
assert render_element(view, "tbody tr:last-child") =~ source2.custom_name
end