tests: Fix unchainable helper.waitFor().fail()
The `helper.waitFor()` function returns a jQuery Deferred object. Deferred objects are supposed to have a `.fail()` method that is chainable (it should return `this`). Before this change, `helper.waitFor()` monkey-patched the `.fail()` method with a function that returned `undefined`. Now the monkey-patched `.fail()` returns the Deferred object. Also modernize the code a bit.
This commit is contained in:
parent
4a25559a2d
commit
16b0768a93
1 changed files with 4 additions and 4 deletions
|
@ -164,12 +164,12 @@ var helper = {};
|
|||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var _fail = deferred.fail;
|
||||
const _fail = deferred.fail.bind(deferred);
|
||||
var listenForFail = false;
|
||||
deferred.fail = function(){
|
||||
deferred.fail = (...args) => {
|
||||
listenForFail = true;
|
||||
_fail.apply(this, arguments);
|
||||
}
|
||||
return _fail(...args);
|
||||
};
|
||||
|
||||
var intervalCheck = setInterval(function(){
|
||||
var passed = false;
|
||||
|
|
Loading…
Reference in a new issue