Sha256: 9ca0a035e7bda115d321b0dc26c028c7b111d26d2e5fb310d6035fe69485c44b

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

require "#{File.expand_path(File.dirname(__FILE__))}/helper"

describe "FormHelper" do
  class MockFormHelperContext < Crystal::MockTemplateContext
    include Crystal::FormHelper
  end
  
  before :each do
    @t = MockFormHelperContext.new
  end
  
  it "check_box_tag" do
    @t.check_box_tag('item').should == %(<input class=" checkbox_input" name="item" type="checkbox" value="1"></input>)
  end

  it "field_set_tag" do
    @t.field_set_tag{'content'}.should == %(<fieldset class=" fieldset_input">content</fieldset>)
  end

  it "file_field_tag" do
    @t.file_field_tag('item').should == %(<input class=" file_input" name="item" type="file"></input>)
  end

  it "form_tag" do
    @t.form_tag(:action => '/'){"content"}
    @t.buffer.should == %(<form action="/">content</form>)
  end

  it "hidden_field_tag" do
    @t.hidden_field_tag('item', 'hidden value').should == %(<input class=" hidden_input" name="item" type="hidden" value="hidden value"></input>)
  end

  it "password_field_tag" do
    @t.password_field_tag('item').should == %(<input class=" password_input" name="item" type="password"></input>)
  end

  it "radio_button_tag" do
    @t.radio_button_tag('item').should == %(<input class=" radio_input" name="item" type="radio" value="1"></input>)
  end

  it "select_tag" do
    @t.select_tag('item'){'content'}.should == %(<select class=" select_input" name="item">content</select>)
  end

  it "submit_tag" do
    @t.submit_tag('ok').should == %(<input class=" submit_input" type="submit" value="ok"></input>)
  end

  it "text_field_tag" do
    @t.text_field_tag('item', 'value').should == %(<input class=" text_input" name="item" type="text" value="value"></input>)
  end

  it "text_area_tag" do
    @t.text_area_tag('item', 'value').should == %(<textarea class=" textarea_input" name="item">value</textarea>)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crystal_ext-0.0.11 spec/html/form_helper_spec.rb