diff options
author | Serj Prikhodko <sergey.prikhodko@toptal.com> | 2018-02-22 21:37:15 +0300 |
---|---|---|
committer | Serj Prikhodko <sergey.prikhodko@toptal.com> | 2018-02-27 23:36:05 +0300 |
commit | 9afec1639d42d7d9a496775cd5239fedce27ec22 (patch) | |
tree | 87ba58a21658d305154d366fad6cc9c3c71b7d50 /actionview/test/template | |
parent | 39d2cde65919729ec1ca3663d7872adf8036fd58 (diff) | |
download | rails-9afec1639d42d7d9a496775cd5239fedce27ec22.tar.gz rails-9afec1639d42d7d9a496775cd5239fedce27ec22.tar.bz2 rails-9afec1639d42d7d9a496775cd5239fedce27ec22.zip |
Let select render default selected option for required field
Diffstat (limited to 'actionview/test/template')
-rw-r--r-- | actionview/test/template/form_options_helper_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index f82eada869..8f796bdb83 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -511,6 +511,16 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_required_select_with_default_and_selected_placeholder + assert_dom_equal( + ['<select required="required" name="post[category]" id="post_category"><option disabled="disabled" selected="selected" value="">Choose one</option>', + '<option value="lifestyle">lifestyle</option>', + '<option value="programming">programming</option>', + '<option value="spiritual">spiritual</option></select>'].join("\n"), + select(:post, :category, ["lifestyle", "programming", "spiritual"], { selected: "", disabled: "", prompt: "Choose one" }, { required: true }) + ) + end + def test_select_with_grouped_collection_as_nested_array @post = Post.new |