diff options
author | Frank Groeneveld <frank@ivaldi.nl> | 2014-10-17 08:21:56 +0200 |
---|---|---|
committer | Frank Groeneveld <frank@ivaldi.nl> | 2014-10-17 08:21:56 +0200 |
commit | d611036c7709d7c30cbab3110e20e248283af364 (patch) | |
tree | 0eaa7e790f03f47d6d492f261b10126b38e93117 /actionview/test | |
parent | 4af5899e25229961cbd3df9dfe80c2f46fa04f6c (diff) | |
download | rails-d611036c7709d7c30cbab3110e20e248283af364.tar.gz rails-d611036c7709d7c30cbab3110e20e248283af364.tar.bz2 rails-d611036c7709d7c30cbab3110e20e248283af364.zip |
Use include_blank value as option label
Update select_tag to reflect documentation and behave the same as form builder select. If the value of include_blank is not boolean true, use that value as the option label.
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/form_tag_helper_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index 771e3fefc3..5b9c1948db 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -224,6 +224,12 @@ class FormTagHelperTest < ActionView::TestCase expected = %(<select id="places" name="places"><option value=""></option><option>Home</option><option>Work</option><option>Pub</option></select>) assert_dom_equal expected, actual end + + def test_select_tag_with_include_blank_string + actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, :include_blank => 'Choose' + expected = %(<select id="places" name="places"><option value="">Choose</option><option>Home</option><option>Work</option><option>Pub</option></select>) + assert_dom_equal expected, actual + end def test_select_tag_with_prompt actual = select_tag "places", "<option>Home</option><option>Work</option><option>Pub</option>".html_safe, :prompt => "string" |