[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:
@@ -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
|
||||
Reference in New Issue
Block a user