Browse files

add "submit" method to Node that allows to submit a form node without…

… clicking a button
  • Loading branch information...
1 parent 4ceb874 commit 83905bb48cbb376fceb07c1ae1f60f15a5b35ffb @niklasb niklasb committed with halogenandtoast Sep 24, 2011
Showing with 8 additions and 0 deletions.
  1. +4 −0 lib/capybara/driver/webkit/node.rb
  2. +4 −0 src/capybara.js
View
4 lib/capybara/driver/webkit/node.rb
@@ -77,6 +77,10 @@ def path
invoke "path"
end
+ def submit(opts)
+ invoke "submit"
+ end
+
def trigger(event)
invoke "trigger", event
end
View
4 src/capybara.js
@@ -97,6 +97,10 @@ Capybara = {
return this.nodes[index].tagName.toLowerCase();
},
+ submit: function(index) {
+ return this.nodes[index].submit();
+ },
+
click: function (index) {
var clickEvent = document.createEvent('MouseEvents');
clickEvent.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

0 comments on commit 83905bb

Please sign in to comment.