Sha256: 4b1ab2e0a6bc7946ce16ea8fedc62645fb3886df2ebba71b28d01ee8b30ae799

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 KB

Contents

# encoding: UTF-8
require 'test_helper'

class TextInputTest < ActionView::TestCase
  test 'input generates a text area for text attributes' do
    with_input_for @user, :description, :text
    assert_select 'textarea.text#user_description'
  end

  test 'input generates a text area for text attributes that accept placeholder' do
    with_input_for @user, :description, :text, placeholder: 'Put in some text'
    assert_select 'textarea.text[placeholder="Put in some text"]'
  end

  test 'input generates a placeholder from the translations' do
    store_translations(:en, simple_form: { placeholders: { user: { name: "placeholder from i18n en.simple_form.placeholders.user.name" } } }) do
      with_input_for @user, :name, :text
      assert_select 'textarea.text[placeholder="placeholder from i18n en.simple_form.placeholders.user.name"]'
    end
  end

  test 'input gets maxlength from column definition for text attributes' do
    with_input_for @user, :description, :text
    assert_select 'textarea.text[maxlength="200"]'
  end

  test 'input infers maxlength column definition from validation when present for text attributes' do
    with_input_for @validating_user, :description, :text
    assert_select 'textarea.text[maxlength="50"]'
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
simple_form-3.3.1 test/inputs/text_input_test.rb
simple_form-3.3.0 test/inputs/text_input_test.rb
simple_form-3.2.1 test/inputs/text_input_test.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/simple_form-3.2.0/test/inputs/text_input_test.rb
simple_form-3.2.0 test/inputs/text_input_test.rb
simple_form-3.1.1 test/inputs/text_input_test.rb