Phoenix.LiveViewTest.follow_trigger_action
You're seeing just the macro
follow_trigger_action
, go back to Phoenix.LiveViewTest module for more information.
Receives a form_element
and asserts that phx-trigger-action
has been
set to true, following up on that request.
Imagine you have a LiveView that sends an HTTP form submission. Say that it
sets the phx-trigger-action
to true, as a response to a submit event.
You can follow the trigger action like this:
form = form(live_view, selector, %{"form" => "data"})
# First we submit the form. Optionally verify that phx-trigger-action
# is now part of the form.
assert render_submit(form) =~ ~r/phx-trigger-action/
# Now follow the request made by the form
conn = follow_trigger_action(form, conn)
assert conn.method == "POST"
assert conn.params == %{"form" => "data"}