mirror of
https://github.com/heartcombo/simple_form.git
synced 2022-11-09 12:19:26 -05:00
Do not lookup for hints if it was explicitly given false
After #405 we added hint classes for the wrappers, but this has forced the loading of the hint text doing I18n lookups, even though it was explicitly given false. This checks for the option in #has_hint?, avoiding the lookup in such cases. This issues has been caught after #627 and some further investigation, thanks to @shwoodard.
This commit is contained in:
parent
120c364f7d
commit
645dd5257d
2 changed files with 3 additions and 1 deletions
|
@ -11,7 +11,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def has_hint?
|
||||
hint.present?
|
||||
options[:hint] != false && hint.present?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -264,6 +264,8 @@ class FormBuilderTest < ActionView::TestCase
|
|||
|
||||
test 'builder should be able to disable a hint even if it exists in i18n' do
|
||||
store_translations(:en, :simple_form => { :hints => { :name => 'Hint test' } }) do
|
||||
SimpleForm::Inputs::Base.any_instance.expects(:hint).never
|
||||
|
||||
with_form_for @user, :name, :hint => false
|
||||
assert_no_select 'span.hint'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue