Sha256: 7acae1019b91bdf73524b32ed3c84da54bfdb9e684808eda0fae5330b54042d1

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# coding: utf-8
require File.dirname(__FILE__) + '/../spec_helper'

describe 'time input' do
  
  include FormtasticSpecHelper
  
  before do
    @output_buffer = ''
    mock_everything
    
    semantic_form_for(@new_post) do |builder|
      concat(builder.input(:publish_at, :as => :time))
    end
  end
   
  it_should_have_input_wrapper_with_class("time")
  it_should_have_input_wrapper_with_id("post_publish_at_input")
  it_should_have_a_nested_fieldset
  it_should_apply_error_logic_for_input_type(:time)

  it 'should have a legend containing the label text inside the fieldset' do
    output_buffer.should have_tag('form li.time fieldset legend', /Publish at/)
  end

  it 'should have an ordered list of two items inside the fieldset' do
    output_buffer.should have_tag('form li.time fieldset ol')
    output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
  end

  it 'should have five labels for hour and minute' do
    output_buffer.should have_tag('form li.time fieldset ol li label', :count => 2)
    output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
    output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
  end

  it 'should have two selects for hour and minute' do
    output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
formtastic-0.9.2 spec/inputs/time_input_spec.rb