Sha256: 1bec135d457ec58e7fab62eaf9f02dbc1ea2d0ba7aec3a4d927661d7e945f3c3

Contents?: true

Size: 1.62 KB

Versions: 20

Compression:

Stored size: 1.62 KB

Contents

# encoding: UTF-8
require 'test_helper'

class PriorityInputTest < ActionView::TestCase
  test 'input should generate a country select field' do
    with_input_for @user, :country, :country
    assert_select 'select#user_country'
    assert_select 'select option[value=Brazil]', 'Brazil'
    assert_no_select 'select option[value=][disabled=disabled]'
  end

  test 'input should generate a country select with SimpleForm default' do
    swap SimpleForm, :country_priority => [ 'Brazil' ] do
      with_input_for @user, :country, :country
      assert_select 'select option[value=][disabled=disabled]'
    end
  end

  test 'input should generate a time zone select field' do
    with_input_for @user, :time_zone, :time_zone
    assert_select 'select#user_time_zone'
    assert_select 'select option[value=Brasilia]', '(GMT-03:00) Brasilia'
    assert_no_select 'select option[value=][disabled=disabled]'
  end

  test 'input should generate a time zone select field with default' do
    with_input_for @user, :time_zone, :time_zone, :default => 'Brasilia'
    assert_select 'select option[value=Brasilia][selected=selected]'
    assert_no_select 'select option[value=]'
  end

  test 'input should generate a time zone select using options priority' do
    with_input_for @user, :time_zone, :time_zone, :priority => /Brasilia/
    assert_select 'select option[value=][disabled=disabled]'
    assert_no_select 'select option[value=]', /^$/
  end

  test 'priority input should not generate invalid required html attribute' do
    with_input_for @user, :country, :country
    assert_select 'select.required'
    assert_no_select 'select[required]'
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
simple_form-2.1.3 test/inputs/priority_input_test.rb
simple_form-2.1.2 test/inputs/priority_input_test.rb
simple_form-2.1.1 test/inputs/priority_input_test.rb
simple_form_awesome-2.5.0 test/inputs/priority_input_test.rb
simple_form_awesome-2.4.0 test/inputs/priority_input_test.rb
simple_form_awesome-2.3.0 test/inputs/priority_input_test.rb
simple_form_awesome-2.2.0 test/inputs/priority_input_test.rb
simple_form-2.1.0 test/inputs/priority_input_test.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.4/test/inputs/priority_input_test.rb
simple_form-2.0.4 test/inputs/priority_input_test.rb
simple_form-2.0.3 test/inputs/priority_input_test.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.2/test/inputs/priority_input_test.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.2/test/inputs/priority_input_test.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.2/test/inputs/priority_input_test.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.2/test/inputs/priority_input_test.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/simple_form-2.0.2/test/inputs/priority_input_test.rb
simple_form-2.0.2 test/inputs/priority_input_test.rb
ehoch_simple_form-2.0.2.dev test/inputs/priority_input_test.rb
simple_form-2.0.1 test/inputs/priority_input_test.rb
simple_form-2.0.0 test/inputs/priority_input_test.rb