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
Richard Hansen 2020-10-11 21:48:40 -04:00 committed by John McLear
parent 4a25559a2d
commit 16b0768a93
1 changed files with 4 additions and 4 deletions

View File

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