Merge remote-tracking branch 'origin/main' into 170-userdata-for-profile-button
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
commit
d40bc0bb82
8 changed files with 406 additions and 0 deletions
33
test/mv_web/components/search_bar_component_test.exs
Normal file
33
test/mv_web/components/search_bar_component_test.exs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
defmodule MvWeb.Components.SearchBarComponentTest do
|
||||
use MvWeb.ConnCase, async: true
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
describe "SearchBarComponent" do
|
||||
test "renders with placeholder", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, view, _html} = live(conn, "/members")
|
||||
|
||||
assert has_element?(view, "input[placeholder='Search...']")
|
||||
end
|
||||
|
||||
test "updates query when user types", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
{:ok, view, _html} = live(conn, "/members")
|
||||
|
||||
# simulate search input and check that other members are not listed
|
||||
html =
|
||||
view
|
||||
|> element("form[role=search]")
|
||||
|> render_change(%{"query" => "Friedrich"})
|
||||
|
||||
refute html =~ "Greta"
|
||||
|
||||
html =
|
||||
view
|
||||
|> element("form[role=search]")
|
||||
|> render_change(%{"query" => "Greta"})
|
||||
|
||||
refute html =~ "Friedrich"
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue