From 27c8debdc6b242c845a279187205a2b057e18469 Mon Sep 17 00:00:00 2001 From: Rusty Geldmacher Date: Tue, 10 Jul 2012 12:14:06 -0400 Subject: Fixed bug creating invalid HTML in select options When a select tag is created for a field with errors, and that select tag has :prompt or :include_blank options, then the inserted first option will errantly have a
wrapping it. See https://github.com/rails/rails/issues/7017 --- actionpack/test/template/active_model_helper_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/active_model_helper_test.rb b/actionpack/test/template/active_model_helper_test.rb index 66a7bce71e..058db29645 100644 --- a/actionpack/test/template/active_model_helper_test.rb +++ b/actionpack/test/template/active_model_helper_test.rb @@ -41,6 +41,19 @@ class ActiveModelHelperTest < ActionView::TestCase ) end + def test_select_with_errors + assert_dom_equal( + %(
), + select("post", "author_name", [:a, :b]) + ) + end + + def test_select_with_errors_and_blank_option + expected_dom = %(
) + assert_dom_equal(expected_dom, select("post", "author_name", [:a, :b], :include_blank => 'Choose one...')) + assert_dom_equal(expected_dom, select("post", "author_name", [:a, :b], :prompt => 'Choose one...')) + end + def test_date_select_with_errors assert_dom_equal( %(
\n\n\n
), -- cgit v1.2.3