1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/test/inputs/text_input_test.rb

25 lines
904 B
Ruby
Raw Normal View History

# encoding: UTF-8
require 'test_helper'
class TextInputTest < ActionView::TestCase
test 'input should generate a text area for text attributes' do
with_input_for @user, :description, :text
assert_select 'textarea.text#user_description'
end
test 'input should generate 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 should get maxlength from column definition for text attributes' do
with_input_for @user, :description, :text
assert_select 'textarea.text[maxlength=200]'
end
test 'input should infer 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