Move form tests to the proper test file
This commit is contained in:
parent
c4ebf81b6b
commit
3a435b1727
2 changed files with 55 additions and 51 deletions
55
test/dsl/form_test.exs
Normal file
55
test/dsl/form_test.exs
Normal file
|
@ -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{<form}
|
||||
assert result =~ ~s{</form>}
|
||||
end
|
||||
|
||||
test "can take a block" do
|
||||
conn = %Plug.Conn{}
|
||||
action = "/"
|
||||
opts = []
|
||||
|
||||
{:safe, result} =
|
||||
htm do
|
||||
form_for conn, action, opts do
|
||||
div()
|
||||
end
|
||||
end
|
||||
|
||||
assert result =~ ~s{<form}
|
||||
assert result =~ ~s{<div></div>}
|
||||
assert result =~ ~s{</form>}
|
||||
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{<form}
|
||||
assert result =~ ~s{<input}
|
||||
assert result =~ ~s{type="text"}
|
||||
assert result =~ ~s{name="bob"}
|
||||
assert result =~ ~s{</form>}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -210,55 +210,4 @@ defmodule Dsl.HtmlTest do
|
|||
~s{<div data-controller="stimulus-controller" data-target="stimulus-target"></div>}
|
||||
end
|
||||
end
|
||||
|
||||
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{<form}
|
||||
assert result =~ ~s{</form>}
|
||||
end
|
||||
|
||||
test "can take a block" do
|
||||
conn = %Plug.Conn{}
|
||||
action = "/"
|
||||
opts = []
|
||||
|
||||
{:safe, result} =
|
||||
htm do
|
||||
form_for conn, action, opts do
|
||||
div()
|
||||
end
|
||||
end
|
||||
|
||||
assert result =~ ~s{<form}
|
||||
assert result =~ ~s{<div></div>}
|
||||
assert result =~ ~s{</form>}
|
||||
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{<form}
|
||||
assert result =~ ~s{<input}
|
||||
assert result =~ ~s{type="text"}
|
||||
assert result =~ ~s{name="bob"}
|
||||
assert result =~ ~s{</form>}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Reference in a new issue