Sha256: 0443ee1df7577b62ea17d1a4243ee44ae9fa80144fc03e92e736f876315ba951

Contents?: true

Size: 979 Bytes

Versions: 11

Compression:

Stored size: 979 Bytes

Contents

# encoding: UTF-8
require 'test_helper'

class HiddenInputTest < ActionView::TestCase
  test 'input generates a hidden field' do
    with_input_for @user, :name, :hidden
    assert_no_select 'input[type=text]'
    assert_select 'input#user_name[type=hidden]'
  end

  test 'hint does not be generated for hidden fields' do
    store_translations(:en, simple_form: { hints: { user: { name: "text" } } }) do
      with_input_for @user, :name, :hidden
      assert_no_select 'span.hint'
    end
  end

  test 'label does not be generated for hidden inputs' do
    with_input_for @user, :name, :hidden
    assert_no_select 'label'
  end

  test 'required/aria-required/optional options does not be generated for hidden inputs' do
    with_input_for @user, :name, :hidden
    assert_no_select 'input.required'
    assert_no_select 'input[required]'
    assert_no_select 'input[aria-required]'
    assert_no_select 'input.optional'
    assert_select 'input.hidden#user_name'
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
simple_form-3.5.0 test/inputs/hidden_input_test.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/simple_form-3.4.0/test/inputs/hidden_input_test.rb
simple_form-3.4.0 test/inputs/hidden_input_test.rb
simple_form-3.3.1 test/inputs/hidden_input_test.rb
simple_form-3.3.0 test/inputs/hidden_input_test.rb
simple_form-3.2.1 test/inputs/hidden_input_test.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/simple_form-3.2.0/test/inputs/hidden_input_test.rb
simple_form-3.2.0 test/inputs/hidden_input_test.rb
simple_form-3.1.1 test/inputs/hidden_input_test.rb
simple_form-3.1.0 test/inputs/hidden_input_test.rb
simple_form-3.1.0.rc2 test/inputs/hidden_input_test.rb