Fixed da tests
This commit is contained in:
parent
e43fbd2888
commit
ba5803d756
2 changed files with 10 additions and 10 deletions
|
|
@ -41,12 +41,12 @@ defmodule PinchflatWeb.CustomComponents.TableComponents do
|
||||||
phx-value-sort_key={col[:sort_key]}
|
phx-value-sort_key={col[:sort_key]}
|
||||||
>
|
>
|
||||||
<div class="relative">
|
<div class="relative">
|
||||||
{col[:label]}
|
{col[:label]}
|
||||||
<.icon
|
<.icon
|
||||||
:if={to_string(@sort_key) == col[:sort_key]}
|
:if={to_string(@sort_key) == col[:sort_key]}
|
||||||
name={if @sort_direction == :asc, do: "hero-chevron-up", else: "hero-chevron-down"}
|
name={if @sort_direction == :asc, do: "hero-chevron-up", else: "hero-chevron-down"}
|
||||||
class="w-3 h-3 mt-2 ml-1 absolute"
|
class="w-3 h-3 mt-2 ml-1 absolute"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -59,19 +59,19 @@ defmodule PinchflatWeb.Sources.SourceLive.IndexTableLiveTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "clicking a different row will sort by that attribute", %{conn: conn} do
|
test "clicking a different row will sort by that attribute", %{conn: conn} do
|
||||||
source1 = source_fixture(custom_name: "Source_A", retention_period_days: 10)
|
source1 = source_fixture(custom_name: "Source_A", enabled: true)
|
||||||
source2 = source_fixture(custom_name: "Source_A", retention_period_days: 5)
|
source2 = source_fixture(custom_name: "Source_A", enabled: false)
|
||||||
|
|
||||||
{:ok, view, _html} = live_isolated(conn, IndexTableLive, session: create_session())
|
{:ok, view, _html} = live_isolated(conn, IndexTableLive, session: create_session())
|
||||||
|
|
||||||
# Click the row to change the sort field
|
# 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:first-child") =~ source2.custom_name
|
||||||
assert render_element(view, "tbody tr:last-child") =~ source1.custom_name
|
assert render_element(view, "tbody tr:last-child") =~ source1.custom_name
|
||||||
|
|
||||||
# Click the row to again change the sort direcation
|
# 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:first-child") =~ source1.custom_name
|
||||||
assert render_element(view, "tbody tr:last-child") =~ source2.custom_name
|
assert render_element(view, "tbody tr:last-child") =~ source2.custom_name
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue