Remove unnecessary code
This commit is contained in:
parent
25803824eb
commit
12cae98a62
|
@ -32,7 +32,7 @@ module SimpleForm
|
|||
|
||||
# Select components does not allow the required html tag.
|
||||
def has_required?
|
||||
super && input_type != :select && SimpleForm.use_html5
|
||||
super && input_type != :select
|
||||
end
|
||||
|
||||
# Check if :include_blank must be included by default.
|
||||
|
|
|
@ -14,7 +14,7 @@ module SimpleForm
|
|||
private
|
||||
|
||||
def has_placeholder?
|
||||
(text? || password?) && placeholder_present? && SimpleForm.use_html5
|
||||
(text? || password?) && placeholder_present?
|
||||
end
|
||||
|
||||
def password?
|
||||
|
|
|
@ -16,7 +16,7 @@ module SimpleForm
|
|||
protected
|
||||
|
||||
def has_placeholder?
|
||||
SimpleForm.use_html5 && placeholder_present?
|
||||
placeholder_present?
|
||||
end
|
||||
|
||||
def infer_attributes_from_validations!
|
||||
|
|
|
@ -27,7 +27,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def has_placeholder?
|
||||
placeholder_present? && SimpleForm.use_html5
|
||||
placeholder_present?
|
||||
end
|
||||
|
||||
def string?
|
||||
|
|
|
@ -197,19 +197,6 @@ class InputTest < ActionView::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test 'when not using HTML5, input should not show placeholder attribute' do
|
||||
SimpleForm.use_html5 = false
|
||||
|
||||
store_translations(:en, :simple_form => { :placeholders => { :user => {
|
||||
:name => 'Name goes here'
|
||||
} } }) do
|
||||
with_input_for @user, :name, :string
|
||||
assert_no_select 'input.string[placeholder]'
|
||||
end
|
||||
|
||||
SimpleForm.use_html5 = true
|
||||
end
|
||||
|
||||
[:email, :url, :search, :tel].each do |type|
|
||||
test "input should allow type #{type}" do
|
||||
with_input_for @user, :name, type
|
||||
|
@ -376,13 +363,6 @@ class InputTest < ActionView::TestCase
|
|||
SimpleForm.use_html5 = true
|
||||
end
|
||||
|
||||
test 'when not using HTML5 input should not use placeholder attribute' do
|
||||
SimpleForm.use_html5 = false
|
||||
with_input_for @user, :age, :integer, :placeholder => "Please enter"
|
||||
assert_no_select "input[placeholder]"
|
||||
SimpleForm.use_html5 = true
|
||||
end
|
||||
|
||||
[:integer, :float, :decimal].each do |type|
|
||||
test "#{type} input should infer min value from attributes with greater than or equal validation" do
|
||||
with_input_for @validating_user, :age, type
|
||||
|
@ -413,13 +393,6 @@ class InputTest < ActionView::TestCase
|
|||
assert_select 'textarea.text[placeholder=Put in some text]'
|
||||
end
|
||||
|
||||
test 'when not using HTML5 input should not generate placeholder attribute for text area' do
|
||||
SimpleForm.use_html5 = false
|
||||
with_input_for @user, :description, :text, :placeholder => 'Put in some text'
|
||||
assert_no_select 'textarea.text[placeholder]'
|
||||
SimpleForm.use_html5 = true
|
||||
end
|
||||
|
||||
test 'input should generate a file field' do
|
||||
with_input_for @user, :name, :file
|
||||
assert_select 'input#user_name[type=file]'
|
||||
|
|
Loading…
Reference in New Issue