summaryrefslogtreecommitdiff
path: root/addons/mail/static/tests/models/cc_throttle_function_tests.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:19 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commit1ae64793fa489b2c1d07408cd9671bc7126f78fa (patch)
tree23d908222f4e705b908dd23ef3823c26daf3baf0 /addons/mail/static/tests/models/cc_throttle_function_tests.js
parentaa900d976f6fbb10f3940639b4d918d31a7556ca (diff)
[REF] mail: adapt code after jQuery update
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
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.js20
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();