2011-09-03 12:49:54 -04:00
|
|
|
# encoding: UTF-8
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class HiddenInputTest < ActionView::TestCase
|
|
|
|
test 'input should generate 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 should not be generated for hidden fields' do
|
2011-12-04 07:29:59 -05:00
|
|
|
store_translations(:en, :simple_form => { :hints => { :user => { :name => "text" } } }) do
|
|
|
|
with_input_for @user, :name, :hidden
|
|
|
|
assert_no_select 'span.hint'
|
|
|
|
end
|
2011-09-03 12:49:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'label should not be generated for hidden inputs' do
|
|
|
|
with_input_for @user, :name, :hidden
|
|
|
|
assert_no_select 'label'
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'required/optional options should 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.optional'
|
|
|
|
assert_select 'input.hidden#user_name'
|
|
|
|
end
|
|
|
|
end
|