Permalink
Browse files

Should be able to send click event with one method.

  • Loading branch information...
1 parent ff118af commit 7bb131f34c25ed72926ac2ac74e3e1f23788d8f5 @assaf committed Nov 30, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/zombie/browser.coffee
@@ -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", ->

0 comments on commit 7bb131f

Please sign in to comment.