Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Should be able to send click event with one method.

  • Loading branch information...
commit 7bb131f34c25ed72926ac2ac74e3e1f23788d8f5 1 parent ff118af
Assaf Arkin authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/zombie/browser.coffee
9 lib/zombie/browser.coffee
View
@@ -312,7 +312,11 @@ class Browser extends EventEmitter
event = @document.createEvent(eventType)
event.initEvent(eventName, true, true)
target.dispatchEvent(event)
- return @wait(callback)
+ return this
+
+ click: (selector)->
+ @fire(selector, "click")
+ return this
# Dispatch asynchronously. Returns true if preventDefault was set.
dispatchEvent: (selector, event)->
@@ -563,7 +567,8 @@ class Browser extends EventEmitter
clickLink: (selector, callback)->
unless link = @link(selector)
throw new Error("No link matching '#{selector}'")
- return @fire(link, "click", callback)
+ @fire(link, "click")
+ return @wait(callback)
# Return the history object.
@prototype.__defineGetter__ "history", ->
Please sign in to comment.
Something went wrong with that request. Please try again.