diff --git a/addons/web/static/tests/helpers/qunit_config.js b/addons/web/static/tests/helpers/qunit_config.js index 641d3a6f09b..8d2b287ab88 100644 --- a/addons/web/static/tests/helpers/qunit_config.js +++ b/addons/web/static/tests/helpers/qunit_config.js @@ -40,6 +40,17 @@ QUnit.config.hidepassed = (window.location.href.match(/[?&]testId=/) === null); var sortButtonAppended = false; +/** + * We override the _.throttle function to avoid the delay in order to be able to + * chain multiple actions using throttle in the same test. + */ +QUnit.begin(function () { + this._initialThrottle = _.throttle; + var self = this; + _.throttle = function (func, wait, options) { + return self._initialThrottle(func, 0, options); + }; +}); /** * This is the way the testing framework knows that tests passed or failed. It * only look in the phantomJS console and check if there is a ok or an error. @@ -56,6 +67,7 @@ QUnit.done(function(result) { if (!sortButtonAppended) { _addSortButton(); } + _.throttle = this._initialThrottle; }); /**