TestDispatch.submit_form
submit_form
, go back to TestDispatch module for more information.
Specs
submit_form(Plug.Conn.t(), %{}, binary() | atom() | nil) :: Plug.Conn.t()
Will find a form in the HTML response of the given conn by entity or by
TestSelector
, or, if no entity or test_selector is provided, it will target
the last form found in the response.
Next it will look for form controls (inputs, selects), convert these to params
and use the attributes passed to submit_form/3
to update the values
of the params. The params will now only contain field keys found in the
controls of the form.
If an entity is given, the params will be prepended by this entity.
Ultimately, the conn is dispatched to the conn's private.phoenix_endpoint
using Phoenix.ConnTest.dispatch/5
, with the params and with the method and
action found in the form.
Specs
submit_form(Plug.Conn.t(), %{}, atom(), binary()) :: Plug.Conn.t()
Works like submit_form/3
. The test_selector is used to find the right form and the
entity is used to find and fill the inputs correctly.