Adding the placeholder=false option

This commit is contained in:
Jonathan Hicks 2010-09-23 05:52:27 +08:00 committed by Carlos Antonio da Silva
parent f42f09a743
commit 85922612fc
2 changed files with 10 additions and 1 deletions

View File

@ -10,7 +10,7 @@ module SimpleForm
input_options[:size] ||= [limit, SimpleForm.default_input_size].compact.min
input_options[:maxlength] ||= limit if limit
input_options[:type] ||= input_type unless input_type == :string
input_options[:placeholder] ||= placeholder
input_options[:placeholder] ||= placeholder unless options[:placeholder] == false
input_options
end

View File

@ -230,6 +230,15 @@ class FormBuilderTest < ActionView::TestCase
assert_select 'span.error#cool', "can't be blank"
end
test 'placeholder should not be generated when set to false' do
store_translations(:en, :simple_form => { :placeholder => { :user => {
:name => 'Name goes here'
} } }) do
with_form_for @user, :name, :placeholder => false
assert_no_select 'input.string[placeholder=Name goes here]'
end
end
# REQUIRED AND PRESENCE VALIDATION
test 'builder input should obtain required from ActiveModel::Validations when it is included' do
with_form_for @validating_user, :name