Fix regression of not sending default values in password fields

This commit is contained in:
Bryan Helmkamp 2008-04-04 16:16:54 +01:00
parent 8227a6764f
commit 4729b9a20a
3 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,9 @@
== Trunk
* Bug fixes
* Fix regression of not sending default values in password fields
== 0.2.0 / 2008-04-04 == 0.2.0 / 2008-04-04
* 4 Major enhancements * 4 Major enhancements

View File

@ -416,7 +416,7 @@ module ActionController
def add_default_params_from_inputs_for(form) # :nodoc: def add_default_params_from_inputs_for(form) # :nodoc:
(form / "input").each do |input| (form / "input").each do |input|
next unless %w[text hidden].include?(input.attributes["type"]) next unless %w[text password hidden].include?(input.attributes["type"])
add_form_data(input, input.attributes["value"]) add_form_data(input, input.attributes["value"])
end end
end end

View File

@ -125,6 +125,17 @@ class ClicksButtonTest < Test::Unit::TestCase
@session.expects(:post_via_redirect).with("/login", {}) @session.expects(:post_via_redirect).with("/login", {})
@session.clicks_button("Login") @session.clicks_button("Login")
end end
def test_should_send_default_password_field_values
@response.stubs(:body).returns(<<-EOS)
<form method="get" action="/login">
<input id="user_password" name="user[password]" value="mypass" type="password" />
<input type="submit" />
</form>
EOS
@session.expects(:get_via_redirect).with("/login", "user" => {"password" => "mypass"})
@session.clicks_button
end
def test_should_send_default_hidden_field_values def test_should_send_default_hidden_field_values
@response.stubs(:body).returns(<<-EOS) @response.stubs(:body).returns(<<-EOS)