Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

formaction support

  • Loading branch information...
commit 253dbcf7f65d5e37eeffa04f8674d0d599288246 1 parent a4399a5
@twalpole twalpole authored
View
3  lib/capybara/rack_test/form.rb
@@ -71,7 +71,8 @@ def params(button)
end
def submit(button)
- driver.submit(method, native['action'].to_s, params(button))
+ action = (button && button['formaction']) || native['action']
+ driver.submit(method, action.to_s, params(button))
end
def multipart?
View
9 lib/capybara/spec/session/click_button_spec.rb
@@ -346,6 +346,15 @@
end
end
+ context "with formaction attribute on button" do
+ it "should submit to the formaction attribute" do
+ @session.click_button('Formaction button')
+ @session.current_path.should == '/form'
+ @results = extract_results(@session)
+ @results['which_form'].should == 'formaction form'
+ end
+ end
+
it "should serialize and send valueless buttons that were clicked" do
@session.click_button('No Value!')
@results = extract_results(@session)
View
7 lib/capybara/spec/views/form.erb
@@ -429,6 +429,13 @@ New line after and before textarea tag
</p>
</form>
+<form action="/other_form" method="post">
+ <p>
+ <input type="text" name="form[which_form]" value="formaction form"/>
+ </p>
+ <input type="submit" name="form[button]" formaction="/form" value="Formaction button"/>
+</form>
+
<form action="relative" method="post">
<p>
<input type="submit" name="form[relative]" value="Relative Action" />
Please sign in to comment.
Something went wrong with that request. Please try again.