Permalink
Browse files

Bootstrap 3 s/control-group/form-group/

  • Loading branch information...
1 parent 7e5b394 commit d364e036804f2bdd4bbabeabb68dc7cb64474eca @sodabrew sodabrew committed Apr 11, 2014
View
78 spec/inputs/boolean_input_spec.rb
@@ -23,81 +23,81 @@
it 'should generate a label containing the input' do
output_buffer.should_not have_tag('label.label')
- output_buffer.should have_tag('form div.control-group div.controls label', :count => 1)
- output_buffer.should have_tag('form div.control-group div.controls label.checkbox', :count => 1)
- output_buffer.should have_tag('form div.control-group div.controls label[@for="post_allow_comments"]')
- output_buffer.should have_tag('form div.control-group div.controls label', /Allow comments/)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"]', :count => 1)
- output_buffer.should have_tag('form div.control-group input[@type="hidden"]', :count => 1)
- output_buffer.should_not have_tag('form div.control-group div.controls label input[@type="hidden"]', :count => 1) # invalid HTML5
+ output_buffer.should have_tag('form div.form-group div.controls label', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls label.checkbox', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls label[@for="post_allow_comments"]')
+ output_buffer.should have_tag('form div.form-group div.controls label', /Allow comments/)
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"]', :count => 1)
+ output_buffer.should_not have_tag('form div.form-group div.controls label input[@type="hidden"]', :count => 1) # invalid HTML5
end
it 'should not add a "name" attribute to the label' do
- output_buffer.should_not have_tag('form div.control-group div.controls label[@name]')
+ output_buffer.should_not have_tag('form div.form-group div.controls label[@name]')
end
it 'should generate a checkbox input' do
- output_buffer.should have_tag('form div.control-group div.controls label input')
- output_buffer.should have_tag('form div.control-group div.controls label input#post_allow_comments')
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"]')
- output_buffer.should have_tag('form div.control-group div.controls label input[@name="post[allow_comments]"]')
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="1"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input')
+ output_buffer.should have_tag('form div.form-group div.controls label input#post_allow_comments')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@name="post[allow_comments]"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="1"]')
end
it 'should generate a checked input if object.method returns true' do
- output_buffer.should have_tag('form div.control-group div.controls label input[@checked="checked"]')
- output_buffer.should have_tag('form div.control-group input[@name="post[allow_comments]"]', :count => 2)
- output_buffer.should have_tag('form div.control-group div.controls input#post_allow_comments', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls label input[@checked="checked"]')
+ output_buffer.should have_tag('form div.form-group input[@name="post[allow_comments]"]', :count => 2)
+ output_buffer.should have_tag('form div.form-group div.controls input#post_allow_comments', :count => 1)
end
it 'should generate a checked input if :input_html is passed :checked => checked' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => {:checked => 'checked'}))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@checked="checked"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@checked="checked"]')
end
it 'should name the hidden input with the :name html_option' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => { :name => "foo" }))
end)
- output_buffer.should have_tag('form div.control-group input[@type="checkbox"][@name="foo"]', :count => 1)
- output_buffer.should have_tag('form div.control-group input[@type="hidden"][@name="foo"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="checkbox"][@name="foo"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"][@name="foo"]', :count => 1)
end
it 'should name the hidden input with the :name html_option' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:answer_comments, :as => :boolean, :input_html => { :name => "foo" }))
end)
- output_buffer.should have_tag('form div.control-group input[@type="checkbox"][@name="foo"]', :count => 1)
- output_buffer.should have_tag('form div.control-group input[@type="hidden"][@name="foo"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="checkbox"][@name="foo"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"][@name="foo"]', :count => 1)
end
it "should generate a disabled input and hidden input if :input_html is passed :disabled => 'disabled' " do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:allow_comments, :as => :boolean, :input_html => {:disabled => 'disabled'}))
end)
- output_buffer.should have_tag('form div.control-group label.checkbox input[@disabled="disabled"]', :count => 1)
- output_buffer.should have_tag('form div.control-group input[@type="hidden"][@disabled="disabled"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group label.checkbox input[@disabled="disabled"]', :count => 1)
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"][@disabled="disabled"]', :count => 1)
end
it 'should generate an input[id] with matching label[for] when id passed in :input_html' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:allow_comments, :as => :boolean, :input_html => {:id => 'custom_id'}))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@id="custom_id"]')
- output_buffer.should have_tag('form div.control-group div.controls label[@for="custom_id"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@id="custom_id"]')
+ output_buffer.should have_tag('form div.form-group div.controls label[@for="custom_id"]')
end
it 'should allow checked and unchecked values to be sent' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'checked', :unchecked_value => 'unchecked'))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="checked"]:not([@unchecked_value][@checked_value])')
- output_buffer.should have_tag('form div.control-group input[@type="hidden"][@value="unchecked"]')
- output_buffer.should_not have_tag('form div.control-group div.controls label input[@type="hidden"]') # invalid HTML5
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="checked"]:not([@unchecked_value][@checked_value])')
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"][@value="unchecked"]')
+ output_buffer.should_not have_tag('form div.form-group div.controls label input[@type="hidden"]') # invalid HTML5
end
it 'should generate a checked input if object.method returns checked value' do
@@ -107,7 +107,7 @@
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="yes"][@checked="checked"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="yes"][@checked="checked"]')
end
it 'should not generate a checked input if object.method returns unchecked value' do
@@ -117,7 +117,7 @@
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="yes"]:not([@checked])')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="yes"]:not([@checked])')
end
it 'should generate a checked input if object.method returns checked value' do
@@ -127,7 +127,7 @@
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="yes"][@checked="checked"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="yes"][@checked="checked"]')
end
it 'should not generate a checked input if object.method returns unchecked value' do
@@ -137,29 +137,29 @@
concat(builder.input(:allow_comments, :as => :boolean, :checked_value => 'yes', :unchecked_value => 'no'))
end)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"][@value="yes"]:not([@checked])')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"][@value="yes"]:not([@checked])')
end
it 'should generate a label and a checkbox even if no object is given' do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:allow_comments, :as => :boolean))
end)
- output_buffer.should have_tag('form div.control-group div.controls label[@for="project_allow_comments"]')
- output_buffer.should have_tag('form div.control-group div.controls label', /Allow comments/)
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"]')
+ output_buffer.should have_tag('form div.form-group div.controls label[@for="project_allow_comments"]')
+ output_buffer.should have_tag('form div.form-group div.controls label', /Allow comments/)
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"]')
- output_buffer.should have_tag('form div.control-group div.controls label input#project_allow_comments')
- output_buffer.should have_tag('form div.control-group div.controls label input[@type="checkbox"]')
- output_buffer.should have_tag('form div.control-group div.controls label input[@name="project[allow_comments]"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input#project_allow_comments')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@type="checkbox"]')
+ output_buffer.should have_tag('form div.form-group div.controls label input[@name="project[allow_comments]"]')
end
it "should render hints" do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:allow_comments, :as => :boolean, :hint => 'Allow user to post comment'))
end)
- output_buffer.should have_tag("form div.control-group div.controls span.help-block")
+ output_buffer.should have_tag("form div.form-group div.controls span.help-block")
end
context "when required" do
View
92 spec/inputs/check_boxes_input_spec.rb
@@ -28,12 +28,12 @@
it_should_use_the_collection_when_provided(:check_boxes, 'input[@type="checkbox"]')
it 'should generate a control label with text for the input' do
- output_buffer.should have_tag('form div.control-group > label.control-label')
- output_buffer.should have_tag('form div.control-group > label.control-label', /Posts/)
+ output_buffer.should have_tag('form div.form-group > label.control-label')
+ output_buffer.should have_tag('form div.form-group > label.control-label', /Posts/)
end
it 'should not link the label within the legend to any input' do
- output_buffer.should_not have_tag('form div.control-group > label[@for^="author_post_ids_"]')
+ output_buffer.should_not have_tag('form div.form-group > label[@for^="author_post_ids_"]')
end
it 'should not generate an ordered list with an li.choice for each choice' do
@@ -42,19 +42,19 @@
end
it 'should have one option with a "checked" attribute' do
- output_buffer.should have_tag('form div.control-group div.controls input[@checked]', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls input[@checked]', :count => 1)
end
it 'should not generate hidden inputs with default value blank' do
- output_buffer.should_not have_tag("form div.control-group div.controls label input[@type='hidden'][@value='']")
+ output_buffer.should_not have_tag("form div.form-group div.controls label input[@type='hidden'][@value='']")
end
it 'should not render hidden inputs inside div.controls' do
output_buffer.should_not have_tag("form div.controls input[@type='hidden']")
end
it 'should render one hidden input for each choice outside the ol' do
- output_buffer.should have_tag("form div.control-group > input[@type='hidden']", :count => 1)
+ output_buffer.should have_tag("form div.form-group > input[@type='hidden']", :count => 1)
end
describe "each choice" do
@@ -69,34 +69,34 @@
it 'should contain a label for the radio input with a nested input and label text' do
::Post.all.each do |post|
- output_buffer.should have_tag('form div.control-group div.controls label', /#{post.to_label}/)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='author_post_ids_#{post.id}']")
+ output_buffer.should have_tag('form div.form-group div.controls label', /#{post.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='author_post_ids_#{post.id}']")
end
end
it 'should use values as label.class when value_as_class is true' do
::Post.all.each do |post|
- output_buffer.should have_tag("form div.control-group div.controls label.post_#{post.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label.post_#{post.id}")
end
end
it 'should have a checkbox input but no hidden field for each post' do
::Post.all.each do |post|
- output_buffer.should have_tag("form div.control-group div.controls label input#author_post_ids_#{post.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='author[post_ids][]']", :count => 1)
+ output_buffer.should have_tag("form div.form-group div.controls label input#author_post_ids_#{post.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='author[post_ids][]']", :count => 1)
end
end
it 'should have a hidden field with an empty array value for the collection to allow clearing of all checkboxes' do
- output_buffer.should have_tag("form div.control-group > input[@type=hidden][@name='author[post_ids][]'][@value='']", :count => 1)
+ output_buffer.should have_tag("form div.form-group > input[@type=hidden][@name='author[post_ids][]'][@value='']", :count => 1)
end
it 'the hidden field with an empty array value should be followed by the div.controls' do
- output_buffer.should have_tag("form div.control-group > input[@type=hidden][@name='author[post_ids][]'][@value=''] + div.controls", :count => 1)
+ output_buffer.should have_tag("form div.form-group > input[@type=hidden][@name='author[post_ids][]'][@value=''] + div.controls", :count => 1)
end
it 'should not have a hidden field with an empty string value for the collection' do
- output_buffer.should_not have_tag("form div.control-group > input[@type=hidden][@name='author[post_ids]'][@value='']", :count => 1)
+ output_buffer.should_not have_tag("form div.form-group > input[@type=hidden][@name='author[post_ids]'][@value='']", :count => 1)
end
it 'should have a checkbox and a hidden field for each post with :hidden_field => true' do
@@ -107,15 +107,15 @@
end)
::Post.all.each do |post|
- output_buffer.should have_tag("form div.control-group div.controls label input#author_post_ids_#{post.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='author[post_ids][]']", :count => 2)
+ output_buffer.should have_tag("form div.form-group div.controls label input#author_post_ids_#{post.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='author[post_ids][]']", :count => 2)
end
end
it "should mark input as checked if it's the the existing choice" do
::Post.all.include?(@fred.posts.first).should be_true
- output_buffer.should have_tag("form div.control-group div.controls label input[@checked='checked']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@checked='checked']")
end
end
@@ -131,8 +131,8 @@
output_buffer.should_not have_tag('form li fieldset legend', /Author/)
end
- it 'should generate a div.control-group with a label' do
- output_buffer.should have_tag('form div.control-group label.control-label', /Author/)
+ it 'should generate a div.form-group with a label' do
+ output_buffer.should have_tag('form div.form-group label.control-label', /Author/)
end
it 'should not generate an li tag for each item in the collection' do
@@ -141,17 +141,17 @@
it 'should generate labels for each item' do
::Author.all.each do |author|
- output_buffer.should have_tag('form div.control-group div.controls label', /#{author.to_label}/)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='project_author_id_#{author.id}']")
+ output_buffer.should have_tag('form div.form-group div.controls label', /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='project_author_id_#{author.id}']")
end
end
it 'should generate inputs for each item' do
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls label input#project_author_id_#{author.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@type='checkbox']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='#{author.id}']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='project[author_id][]']")
+ output_buffer.should have_tag("form div.form-group div.controls label input#project_author_id_#{author.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@type='checkbox']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='#{author.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='project[author_id][]']")
end
end
@@ -160,7 +160,7 @@
concat(builder.input(:author_id, :as => :check_boxes, :collection => [["<b>Item 1</b>", 1], ["<b>Item 2</b>", 2]]))
end)
- output_buffer.should have_tag('form div.control-group div.controls label') do |label|
+ output_buffer.should have_tag('form div.form-group div.controls label') do |label|
label.body.should match /&lt;b&gt;Item [12]&lt;\/b&gt;$/
end
end
@@ -178,18 +178,18 @@
it 'should have a checkbox input for each post' do
::Post.all.each do |post|
- output_buffer.should have_tag("form div.control-group div.controls label input#author_post_ids_#{post.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='author[post_ids][]']", :count => ::Post.all.length)
+ output_buffer.should have_tag("form div.form-group div.controls label input#author_post_ids_#{post.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='author[post_ids][]']", :count => ::Post.all.length)
end
end
it "should mark input as checked if it's the the existing choice" do
::Post.all.include?(@fred.posts.first).should be_true
- output_buffer.should have_tag("form div.control-group div.controls label input[@checked='checked']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@checked='checked']")
end
it 'should not generate empty hidden inputs' do
- output_buffer.should_not have_tag("form div.control-group div.controls label input[@type='hidden'][@value='']", :count => ::Post.all.length)
+ output_buffer.should_not have_tag("form div.form-group div.controls label input[@type='hidden'][@value='']", :count => ::Post.all.length)
end
end
@@ -208,7 +208,7 @@
end
it 'should not have any disabled item(s)' do
- output_buffer.should_not have_tag("form div.control-group div.controls label input[@disabled='disabled']")
+ output_buffer.should_not have_tag("form div.form-group div.controls label input[@disabled='disabled']")
end
end
@@ -222,9 +222,9 @@
end
it "should have one item disabled; the specified one" do
- output_buffer.should have_tag("form div.control-group div.controls label input[@disabled='disabled']", :count => 1)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_ids_#{@fred.id}']", /fred/i)
- output_buffer.should have_tag("form div.control-group div.controls label input[@disabled='disabled'][@value='#{@fred.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@disabled='disabled']", :count => 1)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_ids_#{@fred.id}']", /fred/i)
+ output_buffer.should have_tag("form div.form-group div.controls label input[@disabled='disabled'][@value='#{@fred.id}']")
end
end
@@ -238,11 +238,11 @@
end
it "should have multiple items disabled; the specified ones" do
- output_buffer.should have_tag("form div.control-group div.controls label input[@disabled='disabled']", :count => 2)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_ids_#{@bob.id}']", /bob/i)
- output_buffer.should have_tag("form div.control-group div.controls label input[@disabled='disabled'][@value='#{@bob.id}']")
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_ids_#{@fred.id}']", /fred/i)
- output_buffer.should have_tag("form div.control-group div.controls label input[@disabled='disabled'][@value='#{@fred.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@disabled='disabled']", :count => 2)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_ids_#{@bob.id}']", /bob/i)
+ output_buffer.should have_tag("form div.form-group div.controls label input[@disabled='disabled'][@value='#{@bob.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_ids_#{@fred.id}']", /fred/i)
+ output_buffer.should have_tag("form div.form-group div.controls label input[@disabled='disabled'][@value='#{@fred.id}']")
end
end
@@ -375,8 +375,8 @@
end
it 'should check the correct checkboxes' do
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='fiction'][@checked='checked']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='biography'][@checked='checked']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='fiction'][@checked='checked']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='biography'][@checked='checked']")
end
end
@@ -392,7 +392,7 @@
end
it "should have a label for #context2_author_post_ids_19" do
- output_buffer.should have_tag("form div.control-group div.controls label[@for='context2_author_post_ids_19']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='context2_author_post_ids_19']")
end
it_should_have_input_with_id('context2_author_post_ids_19')
@@ -412,8 +412,8 @@
end)
end
- it 'should index the id of the control-group wrapper' do
- output_buffer.should have_tag("div.control-group#author_post_3_authors_input")
+ it 'should index the id of the form-group wrapper' do
+ output_buffer.should have_tag("div.form-group#author_post_3_authors_input")
end
it 'should index the id of the input tag' do
@@ -440,8 +440,8 @@
it "should use array items for labels and values" do
@_collection.each do |post|
- output_buffer.should have_tag('form div.control-group div.controls label', /#{post.first}/)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='author_post_ids_#{post.last}']")
+ output_buffer.should have_tag('form div.form-group div.controls label', /#{post.first}/)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='author_post_ids_#{post.last}']")
end
end
View
22 spec/inputs/date_select_input_spec.rb
@@ -25,24 +25,24 @@
it_should_have_input_wrapper_with_id("post_publish_at_input")
it_should_apply_error_logic_for_input_type(:date_select)
- it 'should have a label with the label text inside the control-group' do
- output_buffer.should have_tag('form div.control-group > label.control-label', /Publish at/)
- output_buffer.should have_tag('form div.control-group label.control-label[@for="post_publish_at"]')
+ it 'should have a label with the label text inside the form-group' do
+ output_buffer.should have_tag('form div.form-group > label.control-label', /Publish at/)
+ output_buffer.should have_tag('form div.form-group label.control-label[@for="post_publish_at"]')
end
it 'should not associate the legend label with the first select' do
- output_buffer.should_not have_tag('form div.control-group label.control-label[@for="post_publish_at_1i"]')
+ output_buffer.should_not have_tag('form div.form-group label.control-label[@for="post_publish_at_1i"]')
end
it 'should not have three labels for year, month and day' do
- output_buffer.should_not have_tag('form div.control-group div.controls label', :count => 3)
- output_buffer.should_not have_tag('form div.control-group div.controls label', /year/i)
- output_buffer.should_not have_tag('form div.control-group div.controls label', /month/i)
- output_buffer.should_not have_tag('form div.control-group div.controls label', /day/i)
+ output_buffer.should_not have_tag('form div.form-group div.controls label', :count => 3)
+ output_buffer.should_not have_tag('form div.form-group div.controls label', /year/i)
+ output_buffer.should_not have_tag('form div.form-group div.controls label', /month/i)
+ output_buffer.should_not have_tag('form div.form-group div.controls label', /day/i)
end
it 'should have three selects for year, month and day' do
- output_buffer.should have_tag('form div.control-group div.controls select', :count => 3)
+ output_buffer.should have_tag('form div.form-group div.controls select', :count => 3)
end
end
@@ -75,8 +75,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_created_at_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_created_at_input")
end
it 'should index the id of the select tag' do
View
8 spec/inputs/datetime_select_input_spec.rb
@@ -27,11 +27,11 @@
it_should_apply_error_logic_for_input_type(:datetime_select)
it 'should have a legend and label with the label text inside the fieldset' do
- output_buffer.should have_tag('form div.control-group.datetime_select label.control-label', /Publish at/)
+ output_buffer.should have_tag('form div.form-group.datetime_select label.control-label', /Publish at/)
end
it 'should have five selects' do
- output_buffer.should have_tag('form div.control-group.datetime_select div.controls select', :count => 5)
+ output_buffer.should have_tag('form div.form-group.datetime_select div.controls select', :count => 5)
end
end
@@ -66,8 +66,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_created_at_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_created_at_input")
end
it 'should index the id of the select tag' do
View
6 spec/inputs/deprecated_time_date_datetime_inputs_spec.rb
@@ -37,9 +37,9 @@
concat(f.input :created_at, :as => :date)
end)
end
- output_buffer.should have_tag('div.control-group.time')
- output_buffer.should have_tag('div.control-group.datetime')
- output_buffer.should have_tag('div.control-group.date')
+ output_buffer.should have_tag('div.form-group.time')
+ output_buffer.should have_tag('div.form-group.datetime')
+ output_buffer.should have_tag('div.form-group.date')
output_buffer.should_not have_tag('li.time_select')
output_buffer.should_not have_tag('li.datetime_select')
output_buffer.should_not have_tag('li.date_select')
View
2 spec/inputs/email_input_spec.rb
@@ -57,7 +57,7 @@
end
it 'should index the id of the wrapper' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
4 spec/inputs/file_input_spec.rb
@@ -28,7 +28,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :file, :input_html => { :class => 'myclass' }))
end)
- output_buffer.should have_tag("form div.control-group div.controls input.myclass")
+ output_buffer.should have_tag("form div.form-group div.controls input.myclass")
end
describe "when namespace is provided" do
@@ -61,7 +61,7 @@
end
it 'should index the id of the control group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
26 spec/inputs/hidden_input_spec.rb
@@ -27,30 +27,30 @@
it_should_not_have_a_label
it "should generate a input field" do
- output_buffer.should have_tag("form div.control-group div.controls input#post_secret")
- output_buffer.should have_tag("form div.control-group div.controls input#post_secret[@type=\"hidden\"]")
- output_buffer.should have_tag("form div.control-group div.controls input#post_secret[@name=\"post[secret]\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_secret")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_secret[@type=\"hidden\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_secret[@name=\"post[secret]\"]")
end
it "should get value from the object" do
- output_buffer.should have_tag("form div.control-group div.controls input#post_secret[@type=\"hidden\"][@value=\"1\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_secret[@type=\"hidden\"][@value=\"1\"]")
end
it "should pass any explicitly specified value - using :value" do
- output_buffer.should have_tag("form div.control-group div.controls input#post_author_id[@type=\"hidden\"][@value=\"99\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_author_id[@type=\"hidden\"][@value=\"99\"]")
end
# Handle Formtastic :input_html options for consistency.
it "should pass any explicitly specified value - using :input_html options" do
- output_buffer.should have_tag("form div.control-group div.controls input#post_published[@type=\"hidden\"][@value=\"true\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_published[@type=\"hidden\"][@value=\"true\"]")
end
it "should pass any option specified using :input_html" do
- output_buffer.should have_tag("form div.control-group div.controls input#new_post_reviewer[@type=\"hidden\"][@class=\"new_post_reviewer\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#new_post_reviewer[@type=\"hidden\"][@class=\"new_post_reviewer\"]")
end
it "should prefer :input_html over directly supplied options" do
- output_buffer.should have_tag("form div.control-group div.controls input#post_author_id[@type=\"hidden\"][@value=\"formtastic_value\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input#post_author_id[@type=\"hidden\"][@value=\"formtastic_value\"]")
end
it "should not render inline errors" do
@@ -62,17 +62,17 @@
concat(builder.input(:secret, :as => :hidden))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls p.inline-errors")
- output_buffer.should_not have_tag("form div.control-group div.controls ul.errors")
+ output_buffer.should_not have_tag("form div.form-group div.controls p.inline-errors")
+ output_buffer.should_not have_tag("form div.form-group div.controls ul.errors")
end
it "should not render inline hints" do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:secret, :as => :hidden, :hint => "all your base are belong to use"))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls p.inline-hints")
- output_buffer.should_not have_tag("form div.control-group div.controls ul.hints")
+ output_buffer.should_not have_tag("form div.form-group div.controls p.inline-hints")
+ output_buffer.should_not have_tag("form div.form-group div.controls ul.hints")
end
describe "when namespace is provided" do
@@ -117,7 +117,7 @@
end
it 'should index the id of the control group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
2 spec/inputs/number_input_spec.rb
@@ -83,7 +83,7 @@
end
it 'should index the id of the control group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
4 spec/inputs/password_input_spec.rb
@@ -71,8 +71,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
2 spec/inputs/phone_input_spec.rb
@@ -57,7 +57,7 @@
end
it 'should index the id of the control group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
44 spec/inputs/radio_input_spec.rb
@@ -28,12 +28,12 @@
it_should_use_the_collection_when_provided(:radio, 'input')
it 'should generate a control label with text for the input' do
- output_buffer.should have_tag('form div.control-group > label.control-label')
- output_buffer.should have_tag('form div.control-group > label.control-label', /Author/)
+ output_buffer.should have_tag('form div.form-group > label.control-label')
+ output_buffer.should have_tag('form div.form-group > label.control-label', /Author/)
end
it 'should have one option with a "checked" attribute' do
- output_buffer.should have_tag('form div.control-group div.controls input[@checked]', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls input[@checked]', :count => 1)
end
describe "each choice" do
@@ -49,23 +49,23 @@
it 'should contain a label for the radio input with a nested input and label text' do
::Author.all.each do |author|
- output_buffer.should have_tag('form div.control-group div.controls label', /#{author.to_label}/)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_id_#{author.id}']")
+ output_buffer.should have_tag('form div.form-group div.controls label', /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_id_#{author.id}']")
end
end
it 'should use values as li.class when value_as_class is true' do
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls label.author_#{author.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label.author_#{author.id}")
end
end
it "should have a radio input" do
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls label input#post_author_id_#{author.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@type='radio']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='#{author.id}']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='post[author_id]']")
+ output_buffer.should have_tag("form div.form-group div.controls label input#post_author_id_#{author.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@type='radio']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='#{author.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='post[author_id]']")
end
end
@@ -78,16 +78,16 @@
concat(builder.input(:author, :as => :radio))
end)
- output_buffer.should have_tag("form div.control-group div.controls label input[@checked='checked']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@checked='checked']")
end
it "should mark the input as disabled if options attached for disabling" do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => :radio, :collection => [["Test", 'test'], ["Try", "try", {:disabled => true}]]))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls label input[@value='test'][@disabled='disabled']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='try'][@disabled='disabled']")
+ output_buffer.should_not have_tag("form div.form-group div.controls label input[@value='test'][@disabled='disabled']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='try'][@disabled='disabled']")
end
it "should not contain invalid HTML attributes" do
@@ -111,26 +111,26 @@
it 'should generate labels for each item' do
::Author.all.each do |author|
- output_buffer.should have_tag('form div.control-group div.controls label', /#{author.to_label}/)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='project_author_id_#{author.id}']")
+ output_buffer.should have_tag('form div.form-group div.controls label', /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='project_author_id_#{author.id}']")
end
end
it 'should html escape the label string' do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_id, :as => :radio, :collection => [["<b>Item 1</b>", 1], ["<b>Item 2</b>", 2]]))
end)
- output_buffer.should have_tag('form div.control-group div.controls label') do |label|
+ output_buffer.should have_tag('form div.form-group div.controls label') do |label|
label.body.should match /&lt;b&gt;Item [12]&lt;\/b&gt;$/
end
end
it 'should generate inputs for each item' do
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls label input#project_author_id_#{author.id}")
- output_buffer.should have_tag("form div.control-group div.controls label input[@type='radio']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@value='#{author.id}']")
- output_buffer.should have_tag("form div.control-group div.controls label input[@name='project[author_id]']")
+ output_buffer.should have_tag("form div.form-group div.controls label input#project_author_id_#{author.id}")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@type='radio']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@value='#{author.id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label input[@name='project[author_id]']")
end
end
end
@@ -232,8 +232,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
4 spec/inputs/range_input_spec.rb
@@ -57,8 +57,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
4 spec/inputs/search_input_spec.rb
@@ -56,8 +56,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
136 spec/inputs/select_input_spec.rb
@@ -23,10 +23,10 @@
it 'should have a option for each key and/or value' do
@array_with_values.each do |v|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{v}']", /^#{v}$/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{v}']", /^#{v}$/)
end
@array_with_keys_and_values.each do |v|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{v.second}']", /^#{v.first}$/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{v.second}']", /^#{v.first}$/)
end
end
end
@@ -40,9 +40,9 @@
end
it 'should draw select options' do
- output_buffer.should have_tag('form div.control-group div.controls select')
- output_buffer.should have_tag('form div.control-group div.controls select#post_reviewer_id')
- output_buffer.should_not have_tag('form div.control-group div.controls select#post_mongoid_reviewer_id')
+ output_buffer.should have_tag('form div.form-group div.controls select')
+ output_buffer.should have_tag('form div.form-group div.controls select#post_reviewer_id')
+ output_buffer.should_not have_tag('form div.form-group div.controls select#post_mongoid_reviewer_id')
end
end
@@ -56,7 +56,7 @@
it 'should have an option for each value' do
@range_with_values.each do |v|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{v}']", /^#{v}$/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{v}']", /^#{v}$/)
end
end
end
@@ -71,7 +71,7 @@
it 'should render select options using provided HTML string' do
2.times do |v|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{v}']", /^#{v}$/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{v}']", /^#{v}$/)
end
end
end
@@ -109,8 +109,8 @@
# it 'should render a select with at least options: true/false' do
# # I don't wanna deal with this right now.
# pending
- # # output_buffer.should have_tag("form div.control-group div.controls select option[@value='true']", /^Yes$/)
- # # output_buffer.should have_tag("form div.control-group div.controls select option[@value='false']", /^No$/)
+ # # output_buffer.should have_tag("form div.form-group div.controls select option[@value='true']", /^Yes$/)
+ # # output_buffer.should have_tag("form div.form-group div.controls select option[@value='false']", /^No$/)
# end
# end
#
@@ -129,8 +129,8 @@
# end
#
# it 'should render a select with at least options: true/false' do
- # output_buffer.should have_tag("form div.control-group div.controls select option[@value='true']", /#{@boolean_select_labels[:yes]}/)
- # output_buffer.should have_tag("form div.control-group div.controls select option[@value='false']", /#{@boolean_select_labels[:no]}/)
+ # output_buffer.should have_tag("form div.form-group div.controls select option[@value='true']", /#{@boolean_select_labels[:yes]}/)
+ # output_buffer.should have_tag("form div.form-group div.controls select option[@value='false']", /#{@boolean_select_labels[:no]}/)
# end
# end
end
@@ -154,42 +154,42 @@
it_should_use_the_collection_when_provided(:select, 'option')
it 'should have a select inside the wrapper' do
- output_buffer.should have_tag('form div.control-group div.controls select')
- output_buffer.should have_tag('form div.control-group div.controls select#post_author_id')
- output_buffer.should have_tag('form div.control-group div.controls select#post_reviewer_id')
+ output_buffer.should have_tag('form div.form-group div.controls select')
+ output_buffer.should have_tag('form div.form-group div.controls select#post_author_id')
+ output_buffer.should have_tag('form div.form-group div.controls select#post_reviewer_id')
end
it 'should have a valid name' do
- output_buffer.should have_tag("form div.control-group div.controls select[@name='post[author_id]']")
- output_buffer.should_not have_tag("form div.control-group div.controls select[@name='post[author_id][]']")
- output_buffer.should_not have_tag("form div.control-group div.controls select[@name='post[reviewer_id][]']")
+ output_buffer.should have_tag("form div.form-group div.controls select[@name='post[author_id]']")
+ output_buffer.should_not have_tag("form div.form-group div.controls select[@name='post[author_id][]']")
+ output_buffer.should_not have_tag("form div.form-group div.controls select[@name='post[reviewer_id][]']")
end
it 'should not create a multi-select' do
- output_buffer.should_not have_tag('form div.control-group div.controls select[@multiple]')
+ output_buffer.should_not have_tag('form div.form-group div.controls select[@multiple]')
end
it 'should not add a hidden input' do
output_buffer.should_not have_tag('form li input[@type="hidden"]')
end
it 'should create a select without size' do
- output_buffer.should_not have_tag('form div.control-group div.controls select[@size]')
+ output_buffer.should_not have_tag('form div.form-group div.controls select[@size]')
end
it 'should have a blank option' do
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should have a select option for each Author' do
- output_buffer.should have_tag("form div.control-group div.controls select[@name='post[author_id]'] option", :count => ::Author.all.size + 1)
+ output_buffer.should have_tag("form div.form-group div.controls select[@name='post[author_id]'] option", :count => ::Author.all.size + 1)
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
end
end
it 'should have one option with a "selected" attribute (bob)' do
- output_buffer.should have_tag("form div.control-group div.controls select[@name='post[author_id]'] option[@selected]", :count => 1)
+ output_buffer.should have_tag("form div.form-group div.controls select[@name='post[author_id]'] option[@selected]", :count => 1)
end
it 'should not singularize the association name' do
@@ -201,7 +201,7 @@
concat(builder.input(:author_status, :as => :select))
end)
- output_buffer.should have_tag('form div.control-group div.controls select#post_author_status_id')
+ output_buffer.should have_tag('form div.form-group div.controls select#post_author_status_id')
end
end
@@ -286,29 +286,29 @@
0.upto(1) do |i|
it 'should have all option groups and the right values' do
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{@continent_names[i]}']", @authors[i].to_label)
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{@continent_names[i]}']", @authors[i].to_label)
end
it 'should have custom group labels' do
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{@continents[i].id}']", @authors[i].to_label)
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{@continents[i].id}']", @authors[i].to_label)
end
it 'should have custom author labels' do
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{@continent_names[i]}']", @authors[i].login)
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{@continent_names[i]}']", @authors[i].login)
end
it 'should have custom author and group labels' do
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{@continents[i].id}']", @authors[i].login)
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{@continents[i].id}']", @authors[i].login)
end
end
it 'should have no duplicate groups' do
- output_buffer.should have_tag('form div.control-group div.controls select optgroup', :count => 8)
+ output_buffer.should have_tag('form div.form-group div.controls select optgroup', :count => 8)
end
it 'should sort the groups on the label method' do
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='Africa']")
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='99']")
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='Africa']")
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='99']")
end
it 'should call find with :include for more optimized queries' do
@@ -338,51 +338,51 @@
it_should_use_the_collection_when_provided(:select, 'option')
it 'should have a select inside the wrapper' do
- output_buffer.should have_tag('form div.control-group div.controls select')
- output_buffer.should have_tag('form div.control-group div.controls select#author_post_ids')
+ output_buffer.should have_tag('form div.form-group div.controls select')
+ output_buffer.should have_tag('form div.form-group div.controls select#author_post_ids')
end
it 'should have a multi-select select' do
- output_buffer.should have_tag('form div.control-group div.controls select[@multiple="multiple"]')
+ output_buffer.should have_tag('form div.form-group div.controls select[@multiple="multiple"]')
end
it 'should append [] to the name attribute for multiple select' do
- output_buffer.should have_tag('form div.control-group div.controls select[@multiple="multiple"][@name="author[post_ids][]"]')
+ output_buffer.should have_tag('form div.form-group div.controls select[@multiple="multiple"][@name="author[post_ids][]"]')
end
it 'should have a hidden field' do
- output_buffer.should have_tag('form div.control-group input[@type="hidden"][@name="author[post_ids][]"]')
+ output_buffer.should have_tag('form div.form-group input[@type="hidden"][@name="author[post_ids][]"]')
end
it 'should have a select option for each Post' do
- output_buffer.should have_tag('form div.control-group div.controls select option', :count => ::Post.all.size)
+ output_buffer.should have_tag('form div.form-group div.controls select option', :count => ::Post.all.size)
::Post.all.each do |post|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{post.id}']", /#{post.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{post.id}']", /#{post.to_label}/)
end
end
it 'should not have a blank option by default' do
- output_buffer.should_not have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should_not have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should respect the :include_blank option for single selects' do
concat(semantic_form_for(@fred) do |builder|
concat(builder.input(:posts, :as => :select, :multiple => false, :include_blank => true))
end)
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should respect the :include_blank option for multiple selects' do
concat(semantic_form_for(@fred) do |builder|
concat(builder.input(:posts, :as => :select, :multiple => true, :include_blank => true))
end)
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should have one option with a "selected" attribute' do
- output_buffer.should have_tag('form div.control-group div.controls select option[@selected]', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls select option[@selected]', :count => 1)
end
end
@@ -402,43 +402,43 @@
it_should_use_the_collection_when_provided(:select, 'option')
it 'should have a select inside the wrapper' do
- output_buffer.should have_tag('form div.control-group div.controls select')
- output_buffer.should have_tag('form div.control-group div.controls select#post_author_ids')
+ output_buffer.should have_tag('form div.form-group div.controls select')
+ output_buffer.should have_tag('form div.form-group div.controls select#post_author_ids')
end
it 'should have a multi-select select' do
- output_buffer.should have_tag('form div.control-group div.controls select[@multiple="multiple"]')
+ output_buffer.should have_tag('form div.form-group div.controls select[@multiple="multiple"]')
end
it 'should have a select option for each Author' do
- output_buffer.should have_tag('form div.control-group div.controls select option', :count => ::Author.all.size)
+ output_buffer.should have_tag('form div.form-group div.controls select option', :count => ::Author.all.size)
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
end
end
it 'should not have a blank option by default' do
- output_buffer.should_not have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should_not have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should respect the :include_blank option for single selects' do
concat(semantic_form_for(@freds_post) do |builder|
concat(builder.input(:authors, :as => :select, :multiple => false, :include_blank => true))
end)
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should respect the :include_blank option for multiple selects' do
concat(semantic_form_for(@freds_post) do |builder|
concat(builder.input(:authors, :as => :select, :multiple => true, :include_blank => true))
end)
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']")
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']")
end
it 'should have one option with a "selected" attribute' do
- output_buffer.should have_tag('form div.control-group div.controls select option[@selected]', :count => 1)
+ output_buffer.should have_tag('form div.form-group div.controls select option[@selected]', :count => 1)
end
end
@@ -451,11 +451,11 @@
end
it 'should have a select with prompt' do
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']", /choose author/, :count => 1)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']", /choose author/, :count => 1)
end
it 'should not have a second blank select option' do
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='']", :count => 1)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='']", :count => 1)
end
end
@@ -467,18 +467,18 @@
end
it 'should generate label' do
- output_buffer.should have_tag('form div.control-group label.control-label', /Author/)
- output_buffer.should have_tag("form div.control-group label.control-label[@for='project_author']")
+ output_buffer.should have_tag('form div.form-group label.control-label', /Author/)
+ output_buffer.should have_tag("form div.form-group label.control-label[@for='project_author']")
end
it 'should generate select inputs' do
- output_buffer.should have_tag('form div.control-group div.controls select#project_author')
- output_buffer.should have_tag('form div.control-group div.controls select option', :count => ::Author.all.size + 1)
+ output_buffer.should have_tag('form div.form-group div.controls select#project_author')
+ output_buffer.should have_tag('form div.form-group div.controls select option', :count => ::Author.all.size + 1)
end
it 'should generate an option to each item' do
::Author.all.each do |author|
- output_buffer.should have_tag("form div.control-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
+ output_buffer.should have_tag("form div.form-group div.controls select option[@value='#{author.id}']", /#{author.to_label}/)
end
end
end
@@ -489,15 +489,15 @@
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :collection => ::Author.all))
end)
- output_buffer.should have_tag("form div.control-group div.controls select[@name='project[author_name]']")
+ output_buffer.should have_tag("form div.form-group div.controls select[@name='project[author_name]']")
end
describe 'and :multiple is set to true through :input_html' do
it "should make the select a multi-select" do
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :input_html => {:multiple => true} ))
end)
- output_buffer.should have_tag("form div.control-group div.controls select[@multiple]")
+ output_buffer.should have_tag("form div.form-group div.controls select[@multiple]")
end
end
@@ -506,7 +506,7 @@
concat(semantic_form_for(:project, :url => 'http://test.host') do |builder|
concat(builder.input(:author_name, :as => :select, :multiple => true, :collection => ["Fred", "Bob"]))
end)
- output_buffer.should have_tag("form div.control-group div.controls select[@multiple]")
+ output_buffer.should have_tag("form div.form-group div.controls select[@multiple]")
end
end
@@ -524,12 +524,12 @@
it 'should generate an option to each item' do
@grouped_opts.each do |opt_pair|
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{opt_pair[0]}']")
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{opt_pair[0]}']")
opt_pair[1].each do |v|
- output_buffer.should have_tag("form div.control-group div.controls select optgroup[@label='#{opt_pair[0]}'] option[@value='#{v}']")
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup[@label='#{opt_pair[0]}'] option[@value='#{v}']")
end
end
- output_buffer.should have_tag("form div.control-group div.controls select optgroup option[@selected]","hands")
+ output_buffer.should have_tag("form div.form-group div.controls select optgroup option[@selected]","hands")
end
end
@@ -551,7 +551,7 @@
end
it "should render a select field" do
- output_buffer.should have_tag("form div.control-group div.controls select", :count => 2)
+ output_buffer.should have_tag("form div.form-group div.controls select", :count => 2)
end
end
@@ -567,7 +567,7 @@
end
it "should render a text field" do
- output_buffer.should have_tag("form div.control-group div.controls input[@type='text']", :count => 2)
+ output_buffer.should have_tag("form div.form-group div.controls input[@type='text']", :count => 2)
end
end
end
@@ -596,8 +596,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
2 spec/inputs/string_input_spec.rb
@@ -63,7 +63,7 @@ def should_have_maxlength(maxlength, options)
concat(builder.input(:title))
end)
- output_buffer.should have_tag("form div.control-group div.controls input##{@new_post.class.name.underscore}_title[@maxlength='#{maxlength}']")
+ output_buffer.should have_tag("form div.form-group div.controls input##{@new_post.class.name.underscore}_title[@maxlength='#{maxlength}']")
end
it 'should have maxlength if the optional :if or :unless options are not supplied' do
View
22 spec/inputs/text_input_spec.rb
@@ -29,31 +29,31 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text, :input_html => { :class => 'myclass' }))
end)
- output_buffer.should have_tag("form div.control-group div.controls textarea.myclass")
+ output_buffer.should have_tag("form div.form-group div.controls textarea.myclass")
end
it "should have a cols attribute when :cols is a number in :input_html" do
output_buffer.replace ''
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text, :input_html => { :cols => 42 }))
end)
- output_buffer.should have_tag("form div.control-group div.controls textarea[@cols='42']")
+ output_buffer.should have_tag("form div.form-group div.controls textarea[@cols='42']")
end
it "should not have a cols attribute when :cols is nil in :input_html" do
output_buffer.replace ''
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text, :input_html => { :cols => nil }))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls textarea[@cols]")
+ output_buffer.should_not have_tag("form div.form-group div.controls textarea[@cols]")
end
it "should have a rows attribute when :rows is a number in :input_html" do
output_buffer.replace ''
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text, :input_html => { :rows => 42 }))
end)
- output_buffer.should have_tag("form div.control-group div.controls textarea[@rows='42']")
+ output_buffer.should have_tag("form div.form-group div.controls textarea[@rows='42']")
end
@@ -62,7 +62,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text, :input_html => { :rows => nil }))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls textarea[@rows]")
+ output_buffer.should_not have_tag("form div.form-group div.controls textarea[@rows]")
end
describe "when namespace is provided" do
@@ -95,8 +95,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
@@ -144,7 +144,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text))
end)
- output_buffer.should have_tag("form div.control-group div.controls textarea[@rows='12']")
+ output_buffer.should have_tag("form div.form-group div.controls textarea[@rows='12']")
end
end
@@ -153,7 +153,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls textarea[@rows]")
+ output_buffer.should_not have_tag("form div.form-group div.controls textarea[@rows]")
end
end
@@ -169,7 +169,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text))
end)
- output_buffer.should have_tag("form div.control-group div.controls textarea[@cols='10']")
+ output_buffer.should have_tag("form div.form-group div.controls textarea[@cols='10']")
end
end
@@ -178,7 +178,7 @@
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => :text))
end)
- output_buffer.should_not have_tag("form div.control-group div.controls textarea[@cols]")
+ output_buffer.should_not have_tag("form div.form-group div.controls textarea[@cols]")
end
end
View
10 spec/inputs/time_select_input_spec.rb
@@ -101,11 +101,11 @@
it_should_apply_error_logic_for_input_type(:time_select)
it 'should have a legend and label with the label text inside the fieldset' do
- output_buffer.should have_tag('form div.control-group.time_select label.control-label', /Publish at/)
+ output_buffer.should have_tag('form div.form-group.time_select label.control-label', /Publish at/)
end
it 'should have two selects for hour and minute' do
- output_buffer.should have_tag('form div.control-group.time_select div.controls select', :count => 2)
+ output_buffer.should have_tag('form div.form-group.time_select div.controls select', :count => 2)
end
end
@@ -117,7 +117,7 @@
end
it 'should have three selects for hour, minute and seconds' do
- output_buffer.should have_tag('form div.control-group.time_select div.controls select', :count => 3)
+ output_buffer.should have_tag('form div.form-group.time_select div.controls select', :count => 3)
end
end
end
@@ -163,8 +163,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_created_at_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_created_at_input")
end
it 'should index the id of the select tag' do
View
28 spec/inputs/time_zone_input_spec.rb
@@ -21,22 +21,22 @@
it_should_apply_error_logic_for_input_type(:time_zone)
it 'should generate a label for the input' do
- output_buffer.should have_tag('form div.control-group label.control-label')
- output_buffer.should have_tag('form div.control-group label.control-label[@for="post_time_zone"]')
- output_buffer.should have_tag('form div.control-group label.control-label', /Time zone/)
+ output_buffer.should have_tag('form div.form-group label.control-label')
+ output_buffer.should have_tag('form div.form-group label.control-label[@for="post_time_zone"]')
+ output_buffer.should have_tag('form div.form-group label.control-label', /Time zone/)
end
it "should generate a select" do
- output_buffer.should have_tag("form div.control-group div.controls select")
- output_buffer.should have_tag("form div.control-group div.controls select#post_time_zone")
- output_buffer.should have_tag("form div.control-group div.controls select[@name=\"post[time_zone]\"]")
+ output_buffer.should have_tag("form div.form-group div.controls select")
+ output_buffer.should have_tag("form div.form-group div.controls select#post_time_zone")
+ output_buffer.should have_tag("form div.form-group div.controls select[@name=\"post[time_zone]\"]")
end
it 'should use input_html to style inputs' do
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:time_zone, :input_html => { :class => 'myclass' }))
end)
- output_buffer.should have_tag("form div.control-group div.controls select.myclass")
+ output_buffer.should have_tag("form div.form-group div.controls select.myclass")
end
describe "when namespace is provided" do
@@ -70,7 +70,7 @@
end
it 'should index the id of the control group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
@@ -92,15 +92,15 @@
end
it 'should generate labels' do
- output_buffer.should have_tag('form div.control-group label.control-label')
- output_buffer.should have_tag('form div.control-group label.control-label[@for="project_time_zone"]')
- output_buffer.should have_tag('form div.control-group label.control-label', /Time zone/)
+ output_buffer.should have_tag('form div.form-group label.control-label')
+ output_buffer.should have_tag('form div.form-group label.control-label[@for="project_time_zone"]')
+ output_buffer.should have_tag('form div.form-group label.control-label', /Time zone/)
end
it 'should generate select inputs' do
- output_buffer.should have_tag("form div.control-group div.controls select")
- output_buffer.should have_tag("form div.control-group div.controls select#project_time_zone")
- output_buffer.should have_tag("form div.control-group div.controls select[@name=\"project[time_zone]\"]")
+ output_buffer.should have_tag("form div.form-group div.controls select")
+ output_buffer.should have_tag("form div.form-group div.controls select#project_time_zone")
+ output_buffer.should have_tag("form div.form-group div.controls select[@name=\"project[time_zone]\"]")
end
end
View
4 spec/inputs/url_input_spec.rb
@@ -56,8 +56,8 @@
end)
end
- it 'should index the id of the control-group' do
- output_buffer.should have_tag("div.control-group#post_author_attributes_3_name_input")
+ it 'should index the id of the form-group' do
+ output_buffer.should have_tag("div.form-group#post_author_attributes_3_name_input")
end
it 'should index the id of the select tag' do
View
44 spec/support/custom_macros.rb
@@ -46,68 +46,68 @@ def it_should_have_a_nested_ordered_list_with_class(klass)
def it_should_have_label_with_text(string_or_regex)
it "should have a label with text '#{string_or_regex}'" do
- output_buffer.should have_tag("form div.control-group label.control-label", string_or_regex)
+ output_buffer.should have_tag("form div.form-group label.control-label", string_or_regex)
end
end
def it_should_have_label_for(element_id)
it "should have a label for ##{element_id}" do
- output_buffer.should have_tag("form div.control-group label.control-label[@for='#{element_id}']")
+ output_buffer.should have_tag("form div.form-group label.control-label[@for='#{element_id}']")
end
end
def it_should_have_an_inline_label_for(element_id)
it "should have a label for ##{element_id}" do
- output_buffer.should have_tag("form div.control-group div.controls label[@for='#{element_id}']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='#{element_id}']")
end
end
def it_should_have_input_with_id(element_id)
it "should have an input with id '#{element_id}'" do
- output_buffer.should have_tag("form div.control-group div.controls input[@id=\"#{element_id}\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input[@id=\"#{element_id}\"]")
end
end
def it_should_have_select_with_id(element_id)
it "should have a select box with id '#{element_id}'" do
- output_buffer.should have_tag("form div.control-group div.controls select##{element_id}")
+ output_buffer.should have_tag("form div.form-group div.controls select##{element_id}")
end
end
def it_should_have_input_with_type(input_type)
it "should have a #{input_type} input" do
- output_buffer.should have_tag("form div.control-group div.controls input[@type=\"#{input_type}\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input[@type=\"#{input_type}\"]")
end
end
def it_should_have_input_with_name(name)
it "should have an input named #{name}" do
- output_buffer.should have_tag("form div.control-group div.controls input[@name=\"#{name}\"]")
+ output_buffer.should have_tag("form div.form-group div.controls input[@name=\"#{name}\"]")
end
end
def it_should_have_select_with_name(name)
it "should have an input named #{name}" do
- output_buffer.should have_tag("form div.control-group div.controls select[@name=\"#{name}\"]")
+ output_buffer.should have_tag("form div.form-group div.controls select[@name=\"#{name}\"]")
end
end
def it_should_have_textarea_with_name(name)
it "should have an input named #{name}" do
- output_buffer.should have_tag("form div.control-group div.controls textarea[@name=\"#{name}\"]")
+ output_buffer.should have_tag("form div.form-group div.controls textarea[@name=\"#{name}\"]")
end
end
def it_should_have_textarea_with_id(element_id)
it "should have an input with id '#{element_id}'" do
- output_buffer.should have_tag("form div.control-group div.controls textarea##{element_id}")
+ output_buffer.should have_tag("form div.form-group div.controls textarea##{element_id}")
end
end
def it_should_have_label_and_input_with_id(element_id)
it "should have an input with id '#{element_id}'" do
- output_buffer.should have_tag("form div.control-group div.controls input##{element_id}")
- output_buffer.should have_tag("form div.control-group label.control-label[@for='#{element_id}']")
+ output_buffer.should have_tag("form div.form-group div.controls input##{element_id}")
+ output_buffer.should have_tag("form div.form-group label.control-label[@for='#{element_id}']")
end
end
@@ -117,7 +117,7 @@ def it_should_use_default_text_field_size_when_not_nil(as)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => as))
end)
- output_buffer.should have_tag("form div.control-group div.controls input[@size='#{Formtastic::FormBuilder.default_text_field_size}']")
+ output_buffer.should have_tag("form div.form-group div.controls input[@size='#{Formtastic::FormBuilder.default_text_field_size}']")
end
end
end
@@ -128,8 +128,8 @@ def it_should_not_use_default_text_field_size_when_nil(as)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => as))
end)
- output_buffer.should have_tag("form div.control-group div.controls input")
- output_buffer.should_not have_tag("form div.control-group div.controls input[@size]")
+ output_buffer.should have_tag("form div.form-group div.controls input")
+ output_buffer.should_not have_tag("form div.form-group div.controls input[@size]")
end
end
end
@@ -139,7 +139,7 @@ def it_should_apply_custom_input_attributes_when_input_html_provided(as)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => as, :input_html => { :class => 'myclass' }))
end)
- output_buffer.should have_tag("form div.control-group div.controls input.myclass")
+ output_buffer.should have_tag("form div.form-group div.controls input.myclass")
end
end
@@ -148,14 +148,14 @@ def it_should_apply_custom_for_to_label_when_input_html_id_provided(as)
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:title, :as => as, :input_html => { :id => 'myid' }))
end)
- output_buffer.should have_tag('form div.control-group label.control-label[@for="myid"]')
+ output_buffer.should have_tag('form div.form-group label.control-label[@for="myid"]')
end
end
def it_should_have_maxlength_matching_column_limit
it 'should have a maxlength matching column limit' do
@new_post.column_for_attribute(:title).limit.should == 50
- output_buffer.should have_tag("form div.control-group div.controls input[@maxlength='50']")
+ output_buffer.should have_tag("form div.form-group div.controls input[@maxlength='50']")
end
end
@@ -314,10 +314,10 @@ def it_should_use_the_collection_when_provided(as, countable)
end
concat(fields)
end)
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_category_name_general']")
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_category_name_design']")
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_category_name_development']")
- output_buffer.should have_tag("form div.control-group div.controls label[@for='post_author_category_name_quasi-serious_inventions']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_category_name_general']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_category_name_design']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_category_name_development']")
+ output_buffer.should have_tag("form div.form-group div.controls label[@for='post_author_category_name_quasi-serious_inventions']")
end
end
end
View
2 spec/support/fb_custom_macros.rb
@@ -8,7 +8,7 @@ module ClassMethods
def it_should_have_bootstrap_horizontal_wrapping
it "should have 'input' class in the right place" do
- output_buffer.should have_tag("form div.control-group div.controls")
+ output_buffer.should have_tag("form div.form-group div.controls")
end
end

0 comments on commit d364e03

Please sign in to comment.