diff options
Diffstat (limited to 'addons/mail/static/tests/models/cc_throttle_function_tests.js')
| -rw-r--r-- | addons/mail/static/tests/models/cc_throttle_function_tests.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/addons/mail/static/tests/models/cc_throttle_function_tests.js b/addons/mail/static/tests/models/cc_throttle_function_tests.js index f5deb6c1f3c..5ab00ef6048 100644 --- a/addons/mail/static/tests/models/cc_throttle_function_tests.js +++ b/addons/mail/static/tests/models/cc_throttle_function_tests.js @@ -10,7 +10,7 @@ QUnit.module('mail', { beforeEach: function () { var self = this; - this.timeoutCDDef = $.Deferred(); + this.timeoutCDDef = testUtils.makeTestPromise(); this.patch = function () { self.ORIGINAL_CCTFO_ON_CD_TIMEOUT = CCThrottleFunctionObject.prototype._onCooldownTimeout; @@ -36,7 +36,7 @@ QUnit.test('cancel()', function (assert) { assert.expect(3); var self = this; - var def = $.Deferred(); + var def = testUtils.makeTestPromise(); var step = 1; var widget = testUtils.createParent({ @@ -52,7 +52,7 @@ QUnit.test('cancel()', function (assert) { } step++; - return $.when(); + return Promise.resolve(); } return this._super.apply(this, arguments); }, @@ -80,7 +80,7 @@ QUnit.test('cancel()', function (assert) { self.timeoutCDDef.resolve(); }); this.timeoutCDDef.then(function () { - assert.verifySteps(['__rpc__1'], + assert.verifySteps([], "function should still have been called once after 2nd function call cancelled"); widget.destroy(); done(); @@ -92,8 +92,8 @@ QUnit.test('clear()', function (assert) { assert.expect(5); var self = this; - var def1 = $.Deferred(); - var def2 = $.Deferred(); + var def1 = testUtils.makeTestPromise(); + var def2 = testUtils.makeTestPromise(); var step = 1; var widget = testUtils.createParent({ @@ -110,7 +110,7 @@ QUnit.test('clear()', function (assert) { } step++; - return $.when(); + return Promise.resolve(); } return this._super.apply(this, arguments); }, @@ -135,14 +135,14 @@ QUnit.test('clear()', function (assert) { }).then(function () { cctFunc(2); }).then(function () { - assert.verifySteps(['__rpc__1'], + assert.verifySteps([], "function should still have been called once (due to long throttle)"); cctFunc.clear(); self.timeoutCDDef.resolve(); def2.resolve(); }); - $.when(self.timeoutCDDef, def2).then(function () { - assert.verifySteps(['__rpc__1', '__rpc__2'], + Promise.all([self.timeoutCDDef, def2]).then(function () { + assert.verifySteps(['__rpc__2'], "function should have been called twice after 'clear' (buffered 2nd function call)"); widget.destroy(); done(); |
