Tidy up last patch tests and update changelog

This commit is contained in:
Carlos Antonio da Silva 2011-04-05 21:23:40 -03:00
parent abf48a740d
commit 72cfbc5bff
4 changed files with 15 additions and 15 deletions

View File

@ -7,6 +7,7 @@
* Add slim form generator (by github.com/fagiani)
* Add form_class configuration option (by github.com/fagiani)
* Default step of "any" for number input with non integer attributes (by github.com/fedesoria)
* Add option to disable HTML5 browser validations on all forms (by github.com/coryschires)
* bug fix
* Fix for file attributes automatic detection, to work with virtual attributes

View File

@ -4,9 +4,6 @@ SimpleForm.setup do |config|
# any of them, change the order, or even add your own components to the stack.
# config.components = [ :placeholder, :label_input, :hint, :error ]
# Allow browsers to use default validations.
# config.disable_browser_validations = false
# Default tag used on hints.
# config.hint_tag = :span
@ -64,6 +61,9 @@ SimpleForm.setup do |config|
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use default HTML5 validations (novalidate option). Default is enabled.
# config.disable_browser_validations = false
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.

View File

@ -11,11 +11,6 @@ module SimpleForm
autoload :Inputs, 'simple_form/inputs'
autoload :MapType, 'simple_form/map_type'
# Allow browsers to use default validations.
mattr_accessor :disable_browser_validations
@@disable_browser_validations = false
# Default tag used on hints.
mattr_accessor :hint_tag
@@hint_tag = :span
@ -96,6 +91,10 @@ module SimpleForm
mattr_accessor :required_by_default
@@required_by_default = true
# Tell browsers whether to use default HTML5 validations.
mattr_accessor :disable_browser_validations
@@disable_browser_validations = false
# Collection of methods to detect if a file type was given.
mattr_accessor :file_methods
@@file_methods = [ :mounted_as, :file?, :public_filename ]

View File

@ -13,16 +13,16 @@ class FormHelperTest < ActionView::TestCase
assert_select 'form.simple_form'
end
test 'simple form should not use default browser validations if specified in the configuration options' do
SimpleForm.disable_browser_validations = true
test 'simple form should use default browser validations by default' do
concat(simple_form_for(:user) do |f| end)
assert_select 'form[novalidate="novalidate"]'
assert_no_select 'form[novalidate]'
end
test 'simple form should use default browser validations by default' do
SimpleForm.disable_browser_validations = false
concat(simple_form_for(:user) do |f| end)
assert_select 'form[novalidate="novalidate"]', false
test 'simple form should not use default browser validations if specified in the configuration options' do
swap SimpleForm, :disable_browser_validations => true do
concat(simple_form_for(:user) do |f| end)
assert_select 'form[novalidate="novalidate"]'
end
end
test 'simple form should add object name as css class to form when object is not present' do