Skip to content

Commit b5b10b5

Browse files
committed
duplicate dispatch_form and name it submit_form
1 parent 8e717cb commit b5b10b5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/test_dispatch.ex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ defmodule TestDispatch do
6565
|> send_to_action(form, conn)
6666
end
6767

68+
@spec submit_form(Plug.Conn.t(), %{}, binary() | atom() | nil) :: Plug.Conn.t()
69+
def submit_form(conn, attrs, entity_or_test_selector),
70+
do: dispatch_form(conn, attrs, entity_or_test_selector)
71+
72+
@doc """
73+
Works like `submit_form/3`. The test_selector is used to find the right form and the
74+
entity is used to find and fill the inputs correctly.
75+
"""
76+
@spec submit_form(Plug.Conn.t(), %{}, atom(), binary()) :: Plug.Conn.t()
77+
78+
def submit_form(conn, attrs, entity, test_selector),
79+
do: dispatch_form(conn, attrs, entity, test_selector)
80+
6881
@doc """
6982
Finds a link by a given conn, test_selector and an optional test_value.
7083
@@ -135,6 +148,11 @@ defmodule TestDispatch do
135148
|> find_link(test_selector, test_value)
136149
|> _dispatch_link(conn)
137150

151+
@spec dispatch_link(nil | Floki.html_tree(), Plug.Conn.t(), binary(), binary() | nil) ::
152+
Plug.Conn.t()
153+
def click_link(conn, test_selector, test_value, tree),
154+
do: dispatch_link(conn, test_selector, test_value, tree)
155+
138156
def _dispatch_link(link, conn) do
139157
endpoint = endpoint_module(conn)
140158

0 commit comments

Comments
 (0)