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

This commit is contained in:
Niklas Baumstark 2011-09-25 00:16:57 +02:00 committed by Matthew Mongeau
parent 4ceb8740fa
commit 83905bb48c
2 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,10 @@ class Capybara::Driver::Webkit
invoke "path"
end
def submit(opts)
invoke "submit"
end
def trigger(event)
invoke "trigger", event
end

View File

@ -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);