Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
added specs for Node#submit and fixed parameter problem
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasb authored and halogenandtoast committed Jan 13, 2012
1 parent 21f4b84 commit d07cf3d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/capybara/driver/webkit/node.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def path
invoke "path" invoke "path"
end end


def submit(opts) def submit(opts = {})
invoke "submit" invoke "submit"
end end


Expand Down
30 changes: 30 additions & 0 deletions spec/driver_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1182,4 +1182,34 @@ def set_automatic_reload(value)
end end
end end
end end

context "form app with server-side handler" do
before(:all) do
@app = lambda do |env|
if env["REQUEST_METHOD"] == "POST"
body = "<html><body><p>Congrats!</p></body></html>"
else
body = <<-HTML
<html>
<head><title>Form</title>
<body>
<form action="/" method="POST">
<input type="hidden" name="abc" value="123" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
HTML
end
[200,
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
[body]]
end
end

it "submits a form without clicking" do
subject.find("//form")[0].submit
subject.body.should include "Congrats"
end
end
end end

0 comments on commit d07cf3d

Please sign in to comment.