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.pull/4415/head
parent
4a25559a2d
commit
16b0768a93
|
@ -164,12 +164,12 @@ var helper = {};
|
||||||
|
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
var _fail = deferred.fail;
|
const _fail = deferred.fail.bind(deferred);
|
||||||
var listenForFail = false;
|
var listenForFail = false;
|
||||||
deferred.fail = function(){
|
deferred.fail = (...args) => {
|
||||||
listenForFail = true;
|
listenForFail = true;
|
||||||
_fail.apply(this, arguments);
|
return _fail(...args);
|
||||||
}
|
};
|
||||||
|
|
||||||
var intervalCheck = setInterval(function(){
|
var intervalCheck = setInterval(function(){
|
||||||
var passed = false;
|
var passed = false;
|
||||||
|
|
Loading…
Reference in New Issue