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/hidden_input_test.rb
2011-09-08 16:04:36 +02:00

28 lines
867 B
Ruby

# 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
with_input_for @user, :name, :hidden, :hint => 'Use with care...'
assert_no_select 'span.hint'
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