Support '&' in submitted values
This commit is contained in:
parent
e6aff6d37c
commit
3b72459298
@ -43,7 +43,8 @@ module Webrat
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
param_parser.parse_query_parameters("#{name}=#{@value}")
|
value = @value.to_s.gsub('&', '%26')
|
||||||
|
param_parser.parse_query_parameters("#{name}=#{value}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def set(value)
|
def set(value)
|
||||||
|
@ -48,6 +48,18 @@ describe "selects" do
|
|||||||
@session.clicks_button
|
@session.clicks_button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should send values with HTML encoded ampersands" do
|
||||||
|
@session.response_body = <<-EOS
|
||||||
|
<form method="post" action="/login">
|
||||||
|
<select name="encoded"><option value="A & B">Encoded</option></select>
|
||||||
|
<input type="submit" />
|
||||||
|
</form>
|
||||||
|
EOS
|
||||||
|
@session.expects(:post).with("/login", "encoded" => "A & B")
|
||||||
|
@session.selects "Encoded", :from => "encoded"
|
||||||
|
@session.clicks_button
|
||||||
|
end
|
||||||
|
|
||||||
it "should work with empty select lists" do
|
it "should work with empty select lists" do
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<form method="post" action="/login">
|
<form method="post" action="/login">
|
||||||
|
Loading…
Reference in New Issue
Block a user