From 508a2bbc96b33395779a41e57cd0a1efa9b08f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Mon, 11 Jan 2021 12:48:21 +0000 Subject: [PATCH] [FIX] mail: adapt useStore test to OWL v1.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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#64352 X-original-commit: c7375ebaf8d4baa6e02534425ed634c7264ce90f Signed-off-by: Géry Debongnie (ged) Signed-off-by: Sébastien Theys (seb) --- .../component_hooks/use_store/use_store_tests.js | 15 +++++++-------- 1 file 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++; }); } }