Submit hidden fields

This commit is contained in:
Jonas Nicklas 2009-11-11 21:41:20 +01:00
parent 147b81d6b3
commit 1cf7bff09f
3 changed files with 9 additions and 1 deletions

View File

@ -49,7 +49,7 @@ class Webcat::Driver::RackTest
class Form < Node
def params(button)
params = []
params << node.xpath(".//input[@type='text']", ".//input[@type='password']").inject([]) do |agg, input|
params << node.xpath(".//input[@type='text']", ".//input[@type='hidden']", ".//input[@type='password']").inject([]) do |agg, input|
agg << param(input['name'].to_s, input['value'].to_s)
agg
end

View File

@ -70,6 +70,10 @@ shared_examples_for "session" do
@results['password'].should == 'seeekrit'
end
it "should serialize and submit hidden fields" do
@results['token'].should == '12345'
end
it "should not serialize fields from other forms" do
@results['middle_name'].should be_nil
end

View File

@ -15,6 +15,10 @@
<label for="form_password">Password</label>
<input type="password" name="form[password]" value="seeekrit" id="form_password"/>
</p>
<p>
<input type="hidden" name="form[token]" value="12345" id="form_token"/>
</p>
<p>
<label for="form_locale">Locale</label>