Tidy up last patch tests and update changelog
This commit is contained in:
parent
abf48a740d
commit
72cfbc5bff
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 ]
|
||||
|
|
|
@ -13,16 +13,16 @@ class FormHelperTest < ActionView::TestCase
|
|||
assert_select 'form.simple_form'
|
||||
end
|
||||
|
||||
test 'simple form should use default browser validations by default' do
|
||||
concat(simple_form_for(:user) do |f| end)
|
||||
assert_no_select 'form[novalidate]'
|
||||
end
|
||||
|
||||
test 'simple form should not use default browser validations if specified in the configuration options' do
|
||||
SimpleForm.disable_browser_validations = true
|
||||
swap SimpleForm, :disable_browser_validations => true do
|
||||
concat(simple_form_for(:user) do |f| end)
|
||||
assert_select 'form[novalidate="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
|
||||
end
|
||||
|
||||
test 'simple form should add object name as css class to form when object is not present' do
|
||||
|
|
Loading…
Reference in New Issue