From 12ae5ef8e300ee0c827b734ff93f728fc2590ca5 Mon Sep 17 00:00:00 2001 From: Mathieu Duckerts-Antoine Date: Thu, 9 Jul 2020 09:09:12 +0000 Subject: [PATCH] [IMP] web: owlCompatibilityExtraNextTick Introduced a function that awaits for an additionnal rendering frame initiated by the Owl compatibility layer processing. By default a simple "nextTick" will handle the rendering of any widget/ component stuctures having at most 1 switch between the type of entities (Component > Widget or Widget > Component). However more time must be spent rendering in case we have additionnal switches. In such cases this function must be used (1 call for each additionnal switch) since it will be removed along with the compatiblity layer once the framework has been entirely converted, and using this helper will make it easier to wipe it from the code base. --- addons/web/static/tests/helpers/test_utils.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index f0f4977b15b..787842974be 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -97,6 +97,25 @@ odoo.define('web.test_utils', async function (require) { return testUtilsDom.returnAfterNextAnimationFrame(); } + /** + * Awaits for an additionnal rendering frame initiated by the Owl + * compatibility layer processing. + * + * By default a simple "nextTick" will handle the rendering of any widget/ + * component stuctures having at most 1 switch between the type of + * entities (Component > Widget or Widget > Component). However more time + * must be spent rendering in case we have additionnal switches. In such + * cases this function must be used (1 call for each additionnal switch) + * since it will be removed along with the compatiblity layer once the + * framework has been entirely converted, and using this helper will make + * it easier to wipe it from the code base. + * + * @returns {Promise} + */ + async function owlCompatibilityExtraNextTick() { + return testUtilsDom.returnAfterNextAnimationFrame(); + } + // Loading static files cannot be properly simulated when their real content is // really needed. This is the case for static XML files so we load them here, // before starting the qunit test suite. @@ -248,6 +267,7 @@ odoo.define('web.test_utils', async function (require) { makeTestPromiseWithAssert: makeTestPromiseWithAssert, nextMicrotaskTick: nextMicrotaskTick, nextTick: nextTick, + owlCompatibilityExtraNextTick, prepareTarget: testUtilsCreate.prepareTarget, returnAfterNextAnimationFrame: testUtilsDom.returnAfterNextAnimationFrame,