From 8e8bf37aa9ff4a32838ac477f97b458e9b99da7e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 17 Apr 2005 09:44:28 +0000 Subject: Fixed DateHelper to return values on the option tags such that they'll work properly in IE with form_remote_tag #1024 [rscottmace@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1184 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/template/active_record_helper_test.rb | 4 +- actionpack/test/template/date_helper_test.rb | 97 +++++++++++----------- .../test/template/form_options_helper_test.rb | 33 ++++---- 3 files changed, 68 insertions(+), 66 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index 67001082b8..5ee7221913 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -85,7 +85,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase def Post.content_columns() [ Column.new(:date, "written_on", "Written on") ] end assert_equal( - %(


\n\n\n

), + %(


\n\n\n

), form("post") ) end @@ -95,7 +95,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase @post.written_on = Time.gm(2004, 6, 15, 16, 30) assert_equal( - %(


\n\n\n — \n : \n

), + %(


\n\n\n — \n : \n

), form("post") ) end diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index ab5cfc1c7a..d33ce160d8 100755 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -34,7 +34,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_day expected = %(\n" assert_equal expected, select_day(Time.mktime(2003, 8, 16)) @@ -44,7 +44,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_day_with_blank expected = %(\n" assert_equal expected, select_day(Time.mktime(2003, 8, 16), :include_blank => true) @@ -54,7 +54,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_day_nil_with_blank expected = %(\n" assert_equal expected, select_day(nil, :include_blank => true) @@ -71,7 +71,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_month_with_blank expected = %(\n" assert_equal expected, select_month(Time.mktime(2003, 8, 16), :include_blank => true) @@ -80,7 +80,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_month_nil_with_blank expected = %(\n" assert_equal expected, select_month(nil, :include_blank => true) @@ -106,7 +106,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_year expected = %(\n" assert_equal expected, select_year(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005) @@ -115,7 +115,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_year_with_type_discarding expected = %(\n" assert_equal expected, select_year( @@ -126,7 +126,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_hour expected = %(\n" assert_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18)) @@ -134,7 +134,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_hour_with_blank expected = %(\n" assert_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true) @@ -142,7 +142,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_hour_nil_with_blank expected = %(\n" assert_equal expected, select_hour(nil, :include_blank => true) @@ -150,7 +150,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_minute expected = %(\n" assert_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18)) @@ -158,7 +158,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_minute_with_blank expected = %(\n" assert_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true) @@ -166,7 +166,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_minute_with_blank_and_step expected = %(\n" assert_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), { :include_blank => true , :minute_step => 15 }) @@ -174,7 +174,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_minute_nil_with_blank expected = %(\n" assert_equal expected, select_minute(nil, :include_blank => true) @@ -182,7 +182,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_minute_nil_with_blank_and_step expected = %(\n" assert_equal expected, select_minute(nil, { :include_blank => true , :minute_step => 15 }) @@ -190,7 +190,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_second expected = %(\n" assert_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18)) @@ -198,7 +198,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_second_with_blank expected = %(\n" assert_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18), :include_blank => true) @@ -206,7 +206,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_second_nil_with_blank expected = %(\n" assert_equal expected, select_second(nil, :include_blank => true) @@ -214,7 +214,7 @@ class DateHelperTest < Test::Unit::TestCase def test_select_date expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date( @@ -235,9 +235,9 @@ class DateHelperTest < Test::Unit::TestCase expected = %(\n" @@ -248,7 +248,7 @@ class DateHelperTest < Test::Unit::TestCase expected << %(\n" assert_equal expected, select_date( @@ -260,9 +260,9 @@ class DateHelperTest < Test::Unit::TestCase expected = %(\n" @@ -273,7 +273,7 @@ class DateHelperTest < Test::Unit::TestCase expected << %(\n" assert_equal expected, select_date( @@ -285,9 +285,9 @@ class DateHelperTest < Test::Unit::TestCase expected = %(\n" @@ -298,7 +298,7 @@ class DateHelperTest < Test::Unit::TestCase expected << %(\n" assert_equal expected, select_date( @@ -308,15 +308,15 @@ class DateHelperTest < Test::Unit::TestCase def test_select_time_with_seconds expected = %(\n" expected << %(\n" expected << %(\n" assert_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true) @@ -324,11 +324,11 @@ class DateHelperTest < Test::Unit::TestCase def test_select_time_without_seconds expected = %(\n" expected << %(\n" assert_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18)) @@ -337,7 +337,7 @@ class DateHelperTest < Test::Unit::TestCase def test_date_select_with_zero_value expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date(0, :start_year => 2003, :end_year => 2005, :prefix => "date[first]") @@ -354,7 +354,7 @@ class DateHelperTest < Test::Unit::TestCase def test_date_select_with_zero_value_and_no_start_year expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date(0, :end_year => Date.today.year+1, :prefix => "date[first]") @@ -371,7 +371,7 @@ class DateHelperTest < Test::Unit::TestCase def test_date_select_with_zero_value_and_no_end_year expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date(0, :start_year => 2003, :prefix => "date[first]") @@ -388,7 +388,7 @@ class DateHelperTest < Test::Unit::TestCase def test_date_select_with_zero_value_and_no_start_and_end_year expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date(0, :prefix => "date[first]") @@ -405,7 +405,7 @@ class DateHelperTest < Test::Unit::TestCase def test_date_select_with_nil_value_and_no_start_and_end_year expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" assert_equal expected, select_date(nil, :prefix => "date[first]") @@ -422,7 +422,7 @@ class DateHelperTest < Test::Unit::TestCase def test_datetime_select_with_nil_value_and_no_start_and_end_year expected = %(\n" expected << %(\n) expected << -%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) +%(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" expected << %(\n" expected << %(\n" assert_equal expected, select_datetime(nil, :prefix => "date[first]") end - end diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 962d0c5069..cedf17c61b 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -75,32 +75,32 @@ class FormOptionsHelperTest < Test::Unit::TestCase def test_array_options_for_select assert_equal( - "\n\n", + "\n\n", options_for_select([ "", "USA", "Sweden" ]) ) end def test_array_options_for_select_with_selection assert_equal( - "\n\n", + "\n\n", options_for_select([ "Denmark", "", "Sweden" ], "") ) end def test_array_options_for_select_with_selection_array assert_equal( - "\n\n", + "\n\n", options_for_select([ "Denmark", "", "Sweden" ], [ "", "Sweden" ]) ) end def test_array_options_for_string_include_in_other_string_bug_fix assert_equal( - "\n", + "\n", options_for_select([ "ruby", "rubyonrails" ], "rubyonrails") ) assert_equal( - "\n", + "\n", options_for_select([ "ruby", "rubyonrails" ], "ruby") ) end @@ -173,7 +173,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase opts = time_zone_options_for_select( nil, zones ) assert_equal "\n" + "" + - "\n" + + "\n" + "\n" + "\n" + "", @@ -185,7 +185,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase opts = time_zone_options_for_select( "E", zones ) assert_equal "\n" + "" + - "\n" + + "\n" + "\n" + "\n" + "", @@ -197,7 +197,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase opts = time_zone_options_for_select( "C", zones ) assert_equal "\n" + "" + - "\n" + + "\n" + "\n" + "\n" + "", @@ -208,7 +208,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post = Post.new @post.category = "" assert_equal( - "", + "", select("post", "category", %w( abe hest)) ) end @@ -217,7 +217,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post = Post.new @post.category = "" assert_equal( - "", + "", select("post", "category", %w( abe hest), :include_blank => true) ) end @@ -249,7 +249,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post.author_name = "Babe" assert_equal( - "", + "", collection_select("post", "author_name", @posts, "author_name", "author_name", { :include_blank => true }, "style" => "width: 200px") ) end @@ -258,7 +258,10 @@ class FormOptionsHelperTest < Test::Unit::TestCase @post = Post.new @post.origin = "Denmark" assert_equal( - "", + "", country_select("post", "origin") ) end @@ -280,7 +283,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase @firm = Firm.new("D") html = time_zone_select("firm", "time_zone", nil, :include_blank => true) assert_equal "" + - "\n" + + "\n" + "\n" + "\n" + "\n" + @@ -330,7 +333,7 @@ class FormOptionsHelperTest < Test::Unit::TestCase assert_equal "