Sha256: c6c97b762f879f68c92c1fc8e57a6a5a63f3557015125a02462b00ccc45e1823

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe 'GenericFormFor::Actions::Base::Icon' do
  include GenericFormForSpecHelper

  before do
    @model = MyModel.new
    @output_buffer = ''
  end
  
  it "should generate submit button with icon" do
    concat(generic_form_for(@model, :url => "/hello") do |builder|
      concat(builder.input(:name))
      concat(builder.action(:submit, :as => :button, :icon => "my-icon"))
    end)
    output_buffer.should have_selector("button[@type='submit'][@name='submit']", :content => "Submit")
    output_buffer.should have_selector("span[@class='my-icon']")
  end
  
  it "should genearate button with icon with options" do
    with_form_config do
      GenericFormFor::FormBuilder.action_wrapper do
        action_html :class => "my-button" do
          icon_html :class => "real-icon"
        end
      end
      concat(generic_form_for(@model, :url => "/hello") do |builder|
        concat(builder.fieldset(:my_legend) do
          builder.input(:email)
          concat(builder.action(:submit, :as => :button, :icon => "my-icon", :icon_html => {:id => "ic", :class => "icons"}))
        end)
      end)
      output_buffer.should have_selector("button[@type='submit'][@name='submit']", :content => "Submit")
      output_buffer.should have_selector("span#ic[@class='my-icon icons real-icon']")
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generic_form_for-0.0.1 spec/actions/base/icon_spec.rb