Phoenix.LiveViewTest.render_submit
You're seeing just the function
render_submit
, go back to Phoenix.LiveViewTest module for more information.
Sends a form submit event given by element
and returns the rendered result.
The element
is created with element/3
and must point to a single
element on the page with a phx-submit
attribute in it. The event name
given set on phx-submit
is then sent to the appropriate LiveView
(or component if phx-target
is set accordingly). All phx-value-*
entries in the element are sent as values. Extra values, including hidden
input fields, can be given with the value
argument.
It returns the contents of the whole LiveView or an {:error, redirect}
tuple.
Examples
{:ok, view, html} = live(conn, "/thermo")
assert view
|> element("form")
|> render_submit(%{deg: 123, avatar: upload}) =~ "123 exceeds limits"
To submit a form along with some with hidden input values:
assert view
|> form("#term", user: %{name: "hello"})
|> render_submit(%{user: %{"hidden_field" => "example"}}) =~ "Name updated"
Sends a form submit event to the view and returns the rendered result.
It returns the contents of the whole LiveView or an {:error, redirect}
tuple.
Examples
{:ok, view, html} = live(conn, "/thermo")
assert html =~ "The temp is: 30℉"
assert render_submit(view, :refresh, %{deg: 32}) =~ "The temp is: 32℉"