Sha256: 7d7c6c0be6f479ec5708540cd40056809ee17ec915c460efddd1730b3e8c749b

Contents?: true

Size: 1.68 KB

Versions: 16

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe 'ButtonHelper' do
  
  include RSpec::Rails::HelperExampleGroup
  include Webrat::HaveTagMatcher
  
  before(:each) do
    @object = mock({
      :new_record? => true
    })
  end
  
  it "should show button tag" do
    helper.jquery_form_for(:new_post, :url => '/hello') do |builder|
      builder.button("My button").should have_tag("button[type='submit'].ui-button") do |text|
        text.should contain("My button")
      end
    end
  end
  
  it "should show button tag with options" do
    helper.jquery_form_for(:new_post, :url => '/hello') do |builder|
      builder.button("My button", :class => "kuku", :type => "reset", :icon => "plus").should have_tag("button[type='reset'][data-icon='ui-icon-plus'].kuku") do |text|
        text.should contain("My button")
      end
    end
  end
  
  it "should show submit button" do
    helper.jquery_form_for(:new_post, :url => '/hello') do |builder|
      builder.object = @object
      builder.submit.should have_tag("button[type='submit'][data-icon='ui-icon-check']") do |text|
        text.should contain("Create")
      end
    end
  end
  
  it "should show cancel button" do
    helper.jquery_form_for(:new_post, :url => '/hello') do |builder|
      builder.cancel.should have_tag("button[type='reset'][data-icon='ui-icon-close']") do |text|
        text.should contain("Cancel")
      end
    end
  end
  
  it "should show cancel button with options" do
    helper.jquery_form_for(:new_post, :url => '/hello') do |builder|
      builder.cancel("data-href" => "/www").should have_tag("button[type='reset'][data-icon='ui-icon-close'][data-href='/www']") do |text|
        text.should contain("Cancel")
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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