I have a LiveView form that allows editing of associations via inputs_for
, but when I try to write tests for that behavior, I haven’t been able to get the test code to fill the appropriate field. I get an error that reads could not find non-disabled input, select or textarea with name "list[tasks][]" within
and then all of the HTML. The name of the field itself is list[tasks][0][description]
.
test "test name", %{list: list} do
task = task_fixture(%{list_id: list.id})
{:ok, show_live, _html} = live(conn, ~p"/lists/#{list}")
assert show_live
|> form("#list-form", list: %{tasks: [%{description: "some description"}]})
|> render_submit()
<.inputs_for :let={task_form} field={@form[:tasks]}>
<.input field={task_form[:description]} type="textarea" />
</.inputs_for>
I’m assuming this is an issue with the arguments I’m passing to form
, but I haven’t been able to figure out how to get it right.