diff --git a/Gemfile.lock b/Gemfile.lock index e89c3a28..baad67c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,23 +31,22 @@ GEM arel (1.0.1) activesupport (~> 3.0.0) builder (2.1.2) - columnize (0.3.1) erubis (2.6.6) abstract (>= 1.0.0) - i18n (0.4.1) - linecache (0.43) - mail (2.2.5) + i18n (0.4.2) + mail (2.2.9) activesupport (>= 2.3.6) - mime-types - treetop (>= 1.4.5) + i18n (~> 0.4.1) + mime-types (~> 1.16) + treetop (~> 1.4.8) mime-types (1.16) - mocha (0.9.8) + mocha (0.9.9) rake polyglot (0.3.1) rack (1.2.1) rack-mount (0.6.13) rack (>= 1.0.0) - rack-test (0.5.4) + rack-test (0.5.6) rack (>= 1.0) rails (3.0.0) actionmailer (= 3.0.0) @@ -63,12 +62,8 @@ GEM rake (>= 0.8.4) thor (~> 0.14.0) rake (0.8.7) - ruby-debug (0.10.3) - columnize (>= 0.1) - ruby-debug-base (~> 0.10.3.0) - ruby-debug-base (0.10.3) - linecache (>= 0.3) - thor (0.14.0) + test-unit (2.1.1) + thor (0.14.4) treetop (1.4.8) polyglot (>= 0.3.1) tzinfo (0.3.23) @@ -79,4 +74,4 @@ PLATFORMS DEPENDENCIES mocha rails (= 3.0.0) - ruby-debug + test-unit diff --git a/lib/simple_form/inputs/mapping_input.rb b/lib/simple_form/inputs/mapping_input.rb index 17e2eda1..8458648f 100644 --- a/lib/simple_form/inputs/mapping_input.rb +++ b/lib/simple_form/inputs/mapping_input.rb @@ -26,7 +26,11 @@ module SimpleForm end def has_placeholder? - text? && super + (text? || password?) && super + end + + def password? + input_type == :password end def text? diff --git a/test/inputs_test.rb b/test/inputs_test.rb index 82b86e6d..9e0899b3 100644 --- a/test/inputs_test.rb +++ b/test/inputs_test.rb @@ -204,6 +204,11 @@ class InputTest < ActionView::TestCase assert_select 'input[type=password].password#user_password' end + test 'input should generate a password field for password attributes that accept placeholder' do + with_input_for @user, :password, :password, :placeholder => 'Password Confirmation' + assert_select 'input[type=password].password[placeholder=Password Confirmation]#user_password' + end + test 'input should generate a file field' do with_input_for @user, :name, :file assert_select 'input#user_name[type=file]'