File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -418,4 +418,37 @@ defmodule AshAdmin.Test.Components.Resource.DataTableFilteringTest do
418418 refute html =~ "Third post about Testing"
419419 end
420420 end
421+
422+ describe "clear filters" do
423+ test "clearing filters restores all results" , % { conn: conn } do
424+ { view , _html } =
425+ live_and_wait ( conn , "/api/admin?domain=Domain&resource=Post&action_type=read&action=read" )
426+
427+ # Apply a filter first
428+ view
429+ |> element ( "form" )
430+ |> render_change ( % { "filters" => % { "body" => "Phoenix" } } )
431+
432+ # Wait for Cinder to re-query
433+ html = render_async ( view )
434+
435+ # Should show only filtered result
436+ assert html =~ "Second post about Phoenix"
437+ refute html =~ "First post about Elixir"
438+ refute html =~ "Third post about Testing"
439+
440+ # Clear the filter by setting it to empty string
441+ view
442+ |> element ( "form" )
443+ |> render_change ( % { "filters" => % { "body" => "" } } )
444+
445+ # Wait for Cinder to re-query
446+ html = render_async ( view )
447+
448+ # Should show all posts again
449+ assert html =~ "First post about Elixir"
450+ assert html =~ "Second post about Phoenix"
451+ assert html =~ "Third post about Testing"
452+ end
453+ end
421454end
You can’t perform that action at this time.
0 commit comments