From cdfa11409c6196d35e890cf1766e1e2cc6f3d7d7 Mon Sep 17 00:00:00 2001 From: Ivan Torres Date: Wed, 14 Jul 2010 01:23:41 -0500 Subject: select :include_blank or :prompt should return escaped string [#5099 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- .../test/template/form_options_helper_test.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'actionpack/test/template/form_options_helper_test.rb') diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 65b5f5ccc1..d14e5020c7 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -210,6 +210,12 @@ class FormOptionsHelperTest < ActionView::TestCase assert grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]]).html_safe? end + def test_grouped_options_for_select_with_prompt_returns_html_escaped_string + assert_dom_equal( + "\n", + grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]], nil, '')) + end + def test_optgroups_with_with_options_with_hash assert_dom_equal( "\n\n", @@ -367,6 +373,15 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_with_blank_as_string_escaped + @post = Post.new + @post.category = "" + assert_dom_equal( + "", + select("post", "category", %w( abe hest), :include_blank => '') + ) + end + def test_select_with_default_prompt @post = Post.new @post.category = "" @@ -394,6 +409,14 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_select_with_given_prompt_escaped + @post = Post.new + assert_dom_equal( + "", + select("post", "category", %w( abe hest), :prompt => '') + ) + end + def test_select_with_prompt_and_blank @post = Post.new @post.category = "" -- cgit v1.2.3