Sha256: 56c1ad1f50e4e99e8f3c83fd47eaeff94df7e3735d2542dd76493e1cf787fa6e

Contents?: true

Size: 1009 Bytes

Versions: 10

Compression:

Stored size: 1009 Bytes

Contents

# frozen_string_literal: true
# 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

10 entries across 10 versions & 1 rubygems

Version Path
simple_form-5.2.0 test/inputs/hidden_input_test.rb
simple_form-5.1.0 test/inputs/hidden_input_test.rb
simple_form-5.0.3 test/inputs/hidden_input_test.rb
simple_form-5.0.2 test/inputs/hidden_input_test.rb
simple_form-5.0.1 test/inputs/hidden_input_test.rb
simple_form-5.0.0 test/inputs/hidden_input_test.rb
simple_form-4.1.0 test/inputs/hidden_input_test.rb
simple_form-4.0.1 test/inputs/hidden_input_test.rb
simple_form-4.0.0 test/inputs/hidden_input_test.rb
simple_form-3.5.1 test/inputs/hidden_input_test.rb