From 446940c366d588e7e895a64caf325f5f99cba0fb Mon Sep 17 00:00:00 2001 From: Alex Soulim Date: Tue, 3 Apr 2012 16:01:00 +0400 Subject: Add HTML5 input[type="time"] helper --- actionpack/test/template/form_helper_test.rb | 26 ++++++++++++++++++++++++ actionpack/test/template/form_tag_helper_test.rb | 5 +++++ 2 files changed, 31 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index beb3ea752a..27cc3ad48a 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -646,6 +646,32 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal(expected, date_field("post", "written_on")) end + def test_time_field + expected = %{} + assert_dom_equal(expected, time_field("post", "written_on")) + end + + def test_time_field_with_datetime_value + expected = %{} + @post.written_on = DateTime.new(2004, 6, 15, 1, 2, 3) + assert_dom_equal(expected, time_field("post", "written_on")) + end + + def test_time_field_with_timewithzone_value + previous_time_zone, Time.zone = Time.zone, 'UTC' + expected = %{} + @post.written_on = Time.zone.parse('2004-06-15 01:02:03') + assert_dom_equal(expected, time_field("post", "written_on")) + ensure + Time.zone = previous_time_zone + end + + def test_time_field_with_nil_value + expected = %{} + @post.written_on = nil + assert_dom_equal(expected, time_field("post", "written_on")) + end + def test_url_field expected = %{} assert_dom_equal(expected, url_field("user", "homepage")) diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 7a645217b8..6574e13558 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -459,6 +459,11 @@ class FormTagHelperTest < ActionView::TestCase assert_dom_equal(expected, date_field_tag("cell")) end + def test_time_field_tag + expected = %{} + assert_dom_equal(expected, time_field_tag("cell")) + end + def test_url_field_tag expected = %{} assert_dom_equal(expected, url_field_tag("homepage")) -- cgit v1.2.3