From 8b5399c476cd3df48bcc7d19156aa898da4a4306 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 23 Jan 2019 15:04:49 +0000 Subject: [PATCH] [FIX] web: properly destroy services in test mock closes odoo/odoo#30793 --- addons/web/static/tests/helpers/test_utils_mock.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web/static/tests/helpers/test_utils_mock.js b/addons/web/static/tests/helpers/test_utils_mock.js index 3eaaae0a46f..ad7878001f3 100644 --- a/addons/web/static/tests/helpers/test_utils_mock.js +++ b/addons/web/static/tests/helpers/test_utils_mock.js @@ -198,6 +198,11 @@ function addMockEnvironment(widget, params) { // widget is destroyed, at the end of each test to avoid collisions core.bus.trigger('clear_cache'); + _(services).chain() + .compact() // services can be defined but null (e.g. ajax) + .reject(function (s) { return s.isDestroyed(); }) + .invoke('destroy'); + DebouncedField.prototype.DEBOUNCE = initialDebounceValue; dom.DEBOUNCE = initialDOMDebounceValue; if (params.debounce === false) {