This commit is contained in:
Carlos Antonio da Silva 2011-06-03 18:34:59 -03:00
parent 6dd5d1bfa3
commit 6e2a40ef01
2 changed files with 5 additions and 3 deletions

View File

@ -40,7 +40,9 @@ module SimpleForm
else dom_class(record_or_name_or_array)
end
options[:html] ||= {}
options[:html][:novalidate] = !SimpleForm.browser_validations if options[:html][:novalidate].nil?
unless options[:html].key?(:novalidate)
options[:html][:novalidate] = !SimpleForm.browser_validations
end
options[:html][:class] = "\#{SimpleForm.form_class} \#{css_class} \#{options[:html][:class]}".strip
with_custom_field_error_proc do

View File

@ -26,13 +26,13 @@ class FormHelperTest < ActionView::TestCase
end
test 'a form specific disabled validation option should override the default enabled browser validation configuration option' do
concat(simple_form_for(:user, :html => {:novalidate => true}) do |f| end)
concat(simple_form_for(:user, :html => { :novalidate => true }) do |f| end)
assert_select 'form[novalidate="novalidate"]'
end
test 'a form specific enabled validation option should override the disabled browser validation configuration option' do
swap SimpleForm, :browser_validations => false do
concat(simple_form_for(:user, :html => {:novalidate => false}) do |f| end)
concat(simple_form_for(:user, :html => { :novalidate => false }) do |f| end)
assert_no_select 'form[novalidate]'
end
end