summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/qweb_tests.js
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2019-03-06 14:02:32 +0100
committerAaron Bohy <aab@odoo.com>2019-03-06 20:07:17 +0100
commitab56e637b7f97ddcdbcc9baea99ae097e342409c (patch)
tree4cb47da9f7ef89b19d18429220a7507470ec12a9 /addons/web/static/tests/qweb_tests.js
parenteeed894fd50e477135e1ac9a82f6e98ce063ab90 (diff)
[REF] web: 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/web/static/tests/qweb_tests.js')
-rw-r--r--addons/web/static/tests/qweb_tests.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/addons/web/static/tests/qweb_tests.js b/addons/web/static/tests/qweb_tests.js
index fbb710d8cfc..fda72e2392b 100644
--- a/addons/web/static/tests/qweb_tests.js
+++ b/addons/web/static/tests/qweb_tests.js
@@ -15,20 +15,20 @@ function loadTest(assert, template, context) {
var done = assert.async();
assert.expect(1);
- var def = $.Deferred();
var qweb = new window.QWeb2.Engine();
-
- qweb.add_template(qwebPath + template, function (error, doc) {
- if (error) {
- return $.Deferred().reject(error);
- }
- def.resolve({
- qweb: qweb,
- doc: doc
+ var prom = new Promise(function (resolve, reject) {
+ qweb.add_template(qwebPath + template, function (error, doc) {
+ if (error) {
+ return reject(error);
+ }
+ resolve({
+ qweb: qweb,
+ doc: doc
+ });
});
});
- def.then(function (r) {
+ prom.then(function (r) {
var qweb = r.qweb;
var doc = r.doc;
assert.expect(doc.querySelectorAll('result').length);
@@ -60,7 +60,7 @@ function loadTest(assert, template, context) {
}
done();
});
- return def;
+ return prom;
}
QUnit.module('QWeb', {}, function () {
@@ -87,7 +87,9 @@ QUnit.module('QWeb', {}, function () {
var WORD_REPLACEMENT = window.QWeb2.WORD_REPLACEMENT;
window.QWeb2.WORD_REPLACEMENT = _.extend({not: '!', None: 'undefined'}, WORD_REPLACEMENT);
loadTest(assert, 'qweb-test-global.xml', {bool: function (v) { return !!v ? 'True' : 'False';}})
- .always(function () {
+ .then(function () {
+ window.QWeb2.WORD_REPLACEMENT = WORD_REPLACEMENT;
+ }, function () {
window.QWeb2.WORD_REPLACEMENT = WORD_REPLACEMENT;
});
});