Skip to content

Commit

Permalink
do not pass include_blank as select attribute, fixes #1646
Browse files Browse the repository at this point in the history
  • Loading branch information
ujifgc committed Apr 5, 2014
1 parent 6285725 commit e57e26e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -12,7 +12,7 @@ def extract_option_tags!(options)
else
options_for_select(extract_option_items!(options), state)
end
if prompt = options[:include_blank]
if prompt = options.delete(:include_blank)
option_tags.unshift(blank_option(prompt))
end
option_tags
Expand Down
7 changes: 7 additions & 0 deletions padrino-helpers/test/test_form_helpers.rb
Expand Up @@ -657,6 +657,13 @@ def protect_from_csrf; false; end
assert_has_tag('select option:first-child', :value => "", :content => "") { actual_html }
end

it 'should include blank as caption' do
opts = { "Red" => ["Rose","Fire"], "Blue" => ["Sky","Sea"] }
actual_html = select_tag( 'color', :grouped_options => opts, :include_blank => 'Choose your destiny' )
assert_has_tag('select option:first-child', :value => "", :content => "Choose your destiny") { actual_html }
assert_has_no_tag('select[include_blank]') { actual_html }
end

it 'should display select tag with grouped options for a nested array' do
opts = [
["Friends",["Yoda",["Obiwan",2]]],
Expand Down

0 comments on commit e57e26e

Please sign in to comment.