Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tabindex should not be passed down to label_html_options (boolean inp…

…ut) fixes #859
  • Loading branch information...
commit 182b95411c28c0ee824456591a69dd1452bcc2d2 1 parent e764875
@justinfrench authored
View
6 lib/formtastic/inputs/boolean_input.rb
@@ -50,7 +50,10 @@ def label_with_nested_checkbox
label_html_options
)
end
-
+
+ # TODO: why are we merging `input_html_options` and then making some of the irrelevant ones `nil`?
+ # Seems like we should be selectively including from input_html_options (a whitelist) instead of
+ # excluding (blacklist).
def label_html_options
prev = super
prev[:class] = prev[:class] - ['label']
@@ -59,6 +62,7 @@ def label_html_options
prev.merge(
:id => nil,
:name => nil,
+ :tabindex => nil,
:for => input_html_options[:id]
)
)
View
7 spec/inputs/boolean_input_spec.rb
@@ -150,6 +150,13 @@
output_buffer.should have_tag('form li label input[@type="checkbox"]')
output_buffer.should have_tag('form li label input[@name="project[allow_comments]"]')
end
+
+ it 'should not pass input_html options down to the label html' do
+ concat(semantic_form_for(@new_post) do |builder|
+ builder.input(:title, :as => :boolean, :input_html => { :tabindex => 2 })
+ end)
+ output_buffer.should_not have_tag('label[tabindex]')
+ end
context "when required" do
Please sign in to comment.
Something went wrong with that request. Please try again.