mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
add a timeout as a quickfix for timing issues
This commit is contained in:
parent
5ca05a5809
commit
5160ed6989
2 changed files with 13 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue