提交 2835ec61 编写于 作者: S Stephen Celis 提交者: José Valim

Custom 'type' attribute support for text_field. [#3646 status:resolved]

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 214b5484
......@@ -798,7 +798,7 @@ def to_input_field_tag(field_type, options = {})
if field_type == "hidden"
options.delete("size")
end
options["type"] = field_type
options["type"] ||= field_type
options["value"] ||= value_before_type_cast(object) unless field_type == "file"
options["value"] &&= html_escape(options["value"])
add_default_name_and_id(options)
......
......@@ -201,6 +201,11 @@ def test_text_field_with_options
hidden_field("post", "title", :value => "Something Else")
end
def test_text_field_with_custom_type
assert_dom_equal '<input id="user_email" size="30" name="user[email]" type="email" />',
text_field("user", "email", :type => "email")
end
def test_check_box
assert_dom_equal(
'<input name="post[secret]" type="hidden" value="0" /><input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" />',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册