summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/main_tests.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/web/static/tests/main_tests.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/web/static/tests/main_tests.js')
-rw-r--r--addons/web/static/tests/main_tests.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/web/static/tests/main_tests.js b/addons/web/static/tests/main_tests.js
new file mode 100644
index 00000000..30164cea
--- /dev/null
+++ b/addons/web/static/tests/main_tests.js
@@ -0,0 +1,25 @@
+// define the 'web.web_client' module because some other modules require it
+odoo.define('web.web_client', async function (require) {
+ "use strict";
+
+ const session = require("web.session");
+ const { bus } = require('web.core');
+
+ // listen to unhandled rejected promises, and when the rejection is not due
+ // to a crash, prevent the browser from displaying an 'unhandledrejection'
+ // error in the console, which would make tests crash on each Promise.reject()
+ // something similar is done by the CrashManagerService, but by default, it
+ // isn't deployed in tests
+ bus.on('crash_manager_unhandledrejection', this, function (ev) {
+ if (!ev.reason || !(ev.reason instanceof Error)) {
+ ev.stopPropagation();
+ ev.stopImmediatePropagation();
+ ev.preventDefault();
+ }
+ });
+
+ owl.config.mode = "dev";
+
+ await session.is_bound;
+ session.owlTemplates = session.owlTemplates.replace(/t-transition/g, 'transition');
+});