summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/component_hooks
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2021-01-11 12:48:21 +0000
committerSébastien Theys <seb@odoo.com>2021-01-11 12:48:21 +0000
commitc7375ebaf8d4baa6e02534425ed634c7264ce90f (patch)
tree21572fa672912ae6da3636ed114cf10b20fefe47 /addons/mail/static/src/component_hooks
parent1e87d7b65bdfef323a6cdae3a54b3beb6aacf3b4 (diff)
[FIX] mail: adapt useStore test to OWL v1.2.1
The intent of the test was to count renders but it counted calls to `onUpdate` which was the same "by luck", but the function was changed to be called more often than renders to fix another bug. Proper way to count renders (after the initial mount) is just to use `patched`. closes odoo/odoo#64267 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Diffstat (limited to 'addons/mail/static/src/component_hooks')
-rw-r--r--addons/mail/static/src/component_hooks/use_store/use_store_tests.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/addons/mail/static/src/component_hooks/use_store/use_store_tests.js b/addons/mail/static/src/component_hooks/use_store/use_store_tests.js
index 19751ee937d..f1a4b054408 100644
--- a/addons/mail/static/src/component_hooks/use_store/use_store_tests.js
+++ b/addons/mail/static/src/component_hooks/use_store/use_store_tests.js
@@ -8,7 +8,7 @@ const {
} = require('mail/static/src/utils/test_utils.js');
const { Component, QWeb, Store } = owl;
-const { useGetters } = owl.hooks;
+const { onPatched, useGetters } = owl.hooks;
const { xml } = owl.tags;
QUnit.module('mail', {}, function () {
@@ -54,10 +54,9 @@ QUnit.test("compare keys, no depth, primitives", async function (assert) {
return {
res: obj.use1 ? obj.subObj1 : obj.subObj2,
};
- }, {
- onUpdate: () => {
- count++;
- },
+ });
+ onPatched(() => {
+ count++;
});
}
}
@@ -135,9 +134,9 @@ QUnit.test("compare keys, depth 1, proxy", async function (assert) {
compareDepth: {
array: 1,
},
- onUpdate: () => {
- count++;
- },
+ });
+ onPatched(() => {
+ count++;
});
}
}