Sha256: 477cf27f2cea6c3da10a678e5374c72147c9baf20c2c22d18d6171e013addc40

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

describe 'CheckBoxesInput' do
  
  include RSpec::Rails::HelperExampleGroup
  include Webrat::HaveTagMatcher
  
  before(:each) do
    @object = mock({
      :new_record? => true,
      :login => "A"
    })
  end
  
  it "should return check boxes tag" do
    helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder|
      builder.object = @object
      builder.input(:login, :as => :check_boxes, :collection => [["A","a"], ["B","b"]]).
      should have_tag("input[type='checkbox'].ui-boolean-input" , :count => 2)
    end
  end
  
  it "should return check boxes tag with options" do
    helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder|
      builder.object = @object
      builder.input(:login, :as => :check_boxes, :collection => [["A","a"]], "data-name" =>"my-name").
      should have_tag("input[type='checkbox'][data-name='my-name'].ui-boolean-input")
    end
  end
  
  it "should return check boxes tag as buttonset" do
    helper.jquery_form_for(:new_post, :as => @object, :url => '/hello') do |builder|
      builder.object = @object
      a = builder.input(:login, :as => :check_boxes, :buttonset => true, :collection => [["A","a"], ["B","b"]])
      a.should have_tag("input[type='checkbox'].ui-boolean-input" , :count => 2)
      a.should have_tag("fieldset.to-buttonset")
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
jquery-ui-form-0.2.8 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.7 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.6 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.5 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.4 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.3 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.2 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.1 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.2.0 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.6 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.5 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.4 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.3 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.2 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.1 spec/inputs/check_boxes_input_spec.rb
jquery-ui-form-0.1.0 spec/inputs/check_boxes_input_spec.rb