1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00

Merge pull request #148 from mrdg/click-timeout

add a timeout as a quickfix for timing issues
This commit is contained in:
Jon Leighton 2012-09-05 10:58:12 -07:00
commit 2af0ab911a
2 changed files with 13 additions and 8 deletions

View file

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

View file

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