diff --git a/lib/capybara/poltergeist/client/browser.coffee b/lib/capybara/poltergeist/client/browser.coffee index 42649f8..25f0b53 100644 --- a/lib/capybara/poltergeist/client/browser.coffee +++ b/lib/capybara/poltergeist/client/browser.coffee @@ -121,9 +121,11 @@ class Poltergeist.Browser @last_click = node.click() - if @state != 'loading' - @state = 'default' - this.sendResponse(@last_click) + setTimeout => + if @state != 'loading' + @state = 'default' + this.sendResponse(@last_click) + , 5 drag: (page_id, id, other_id) -> this.node(page_id, id).dragTo this.node(page_id, other_id) diff --git a/lib/capybara/poltergeist/client/compiled/browser.js b/lib/capybara/poltergeist/client/compiled/browser.js index fc2b7a0..3916f75 100644 --- a/lib/capybara/poltergeist/client/compiled/browser.js +++ b/lib/capybara/poltergeist/client/compiled/browser.js @@ -152,14 +152,17 @@ Poltergeist.Browser = (function() { }; Browser.prototype.click = function(page_id, id) { - var node; + var node, + _this = this; node = this.node(page_id, id); this.state = 'clicked'; this.last_click = node.click(); - if (this.state !== 'loading') { - this.state = 'default'; - return this.sendResponse(this.last_click); - } + return setTimeout(function() { + if (_this.state !== 'loading') { + _this.state = 'default'; + return _this.sendResponse(_this.last_click); + } + }, 5); }; Browser.prototype.drag = function(page_id, id, other_id) {