diff options
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 88014a6564..d62406c2d3 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -349,6 +349,36 @@ class FormHelperTest < ActionView::TestCase ) end + def search_field + expected = %{<input id="contact_notes_query" size="30" name="contact[notes_query]" type="search" />} + assert_dom_equal(expected, search_field("contact", "notes_query")) + end + + def test_telephone_field + expected = %{<input id="user_cell" size="30" name="user[cell]" type="tel" />} + assert_dom_equal(expected, telephone_field("user", "cell")) + end + + def test_url_field + expected = %{<input id="user_homepage" size="30" name="user[homepage]" type="url" />} + assert_dom_equal(expected, url_field("user", "homepage")) + end + + def test_email_field + expected = %{<input id="user_address" size="30" name="user[address]" type="email" />} + assert_dom_equal(expected, email_field("user", "address")) + end + + def test_number_field + expected = %{<input name="order[quantity]" size="30" max="9" id="order_quantity" type="number" min="1" />} + assert_dom_equal(expected, number_field("order", "quantity", :in => 1...10)) + end + + def test_range_input + expected = %{<input name="hifi[volume]" step="0.1" size="30" max="11" id="hifi_volume" type="range" min="0" />} + assert_dom_equal(expected, range_field("hifi", "volume", :in => 0..11, :step => 0.1)) + end + def test_explicit_name assert_dom_equal( '<input id="post_title" name="dont guess" size="30" type="text" value="Hello World" />', text_field("post", "title", "name" => "dont guess") |