diff --git a/test/dsl/form_test.exs b/test/dsl/form_test.exs new file mode 100644 index 0000000..8586ae0 --- /dev/null +++ b/test/dsl/form_test.exs @@ -0,0 +1,55 @@ +defmodule Dsl.FormTest do + use ExUnit.Case, async: true + use Dsl + + describe "form_for" do + test "returns a form tag" do + conn = %Plug.Conn{} + action = "/" + + {:safe, result} = + htm do + form_for(conn, action, []) + end + + assert result =~ ~s{
} + end + + test "can take a block that references the form" do + conn = %Plug.Conn{} + action = "/" + opts = [] + + {:safe, result} = + htm do + form_for conn, action, opts do + text_input(form, :bob) + end + end + + assert result =~ ~s{} - end - - test "can take a block that references the form" do - conn = %Plug.Conn{} - action = "/" - opts = [] - - {:safe, result} = - htm do - form_for conn, action, opts do - text_input(form, :bob) - end - end - - assert result =~ ~s{