[Enhancement] Add sorting, pagination, and new attributes to sources index table (#510)

* WIP - started improving handling of sorting for sources index table

* WIP - Added UI to table to indicate sort column and direction

* Refactored toggle liveview into a livecomponent

* Added sorting for all table attrs

* Added pagination to the sources table

* Added tests for updated liveviews and live components

* Add tests for new helper methods

* Added fancy new CSS to my sources table

* Added size to sources table

* Adds relative div to ensure that sorting arrow doesn't run away

* Fixed da tests
This commit is contained in:
Kieran
2024-12-13 09:49:00 -08:00
committed by GitHub
parent e56f39a158
commit 53e106dac2
16 changed files with 547 additions and 67 deletions
@@ -0,0 +1,26 @@
defmodule PinchflatWeb.Sources.SourceLive.SourceEnableToggleTest do
use PinchflatWeb.ConnCase
import Phoenix.LiveViewTest
alias PinchflatWeb.Sources.SourceLive.SourceEnableToggle
describe "initial rendering" do
test "renders a toggle in the on position if the source is enabled" do
source = %{id: 1, enabled: true}
html = render_component(SourceEnableToggle, %{id: :foo, source: source})
# This is checking the Alpine attrs which is a good-enough proxy for the toggle position
assert html =~ "{ enabled: true }"
end
test "renders a toggle in the off position if the source is disabled" do
source = %{id: 1, enabled: false}
html = render_component(SourceEnableToggle, %{id: :foo, source: source})
assert html =~ "{ enabled: false }"
end
end
end