summaryrefslogtreecommitdiff
path: root/addons/test_website/static/src/js
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2019-06-11 12:26:53 +0000
committerfja-odoo <fja@odoo.com>2019-06-28 08:53:52 +0000
commit90818fd083774988c331d741d34181a5af5ecd3a (patch)
treee67fcc581e0952d80a90185a0926b1ec0601bfc0 /addons/test_website/static/src/js
parent83c1d56d2f3d22672803118f33c2f702721df1e5 (diff)
[IMP] test_website: add test tour for the website errors
The purpose of these tests is to verify that errors informations are displayed correctly on the website. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
Diffstat (limited to 'addons/test_website/static/src/js')
-rw-r--r--addons/test_website/static/src/js/test_error.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/test_website/static/src/js/test_error.js b/addons/test_website/static/src/js/test_error.js
new file mode 100644
index 00000000000..8a0f909d33f
--- /dev/null
+++ b/addons/test_website/static/src/js/test_error.js
@@ -0,0 +1,30 @@
+odoo.define('website_forum.test_error', function (require) {
+'use strict';
+
+var publicWidget = require('web.public.widget');
+
+publicWidget.registry.testError = publicWidget.Widget.extend({
+ selector: '.rpc_error',
+ events: {
+ 'click a': '_onRpcErrorClick',
+ },
+
+ //----------------------------------------------------------------------
+ // Handlers
+ //----------------------------------------------------------------------
+
+ /**
+ * make a rpc call with the href of the DOM element clicked
+ * @private
+ * @param {Event} ev
+ * @returns {Promise}
+ */
+ _onRpcErrorClick: function (ev) {
+ ev.preventDefault();
+ var $link = $(ev.currentTarget);
+ return this._rpc({
+ route: $link.attr('href'),
+ });
+ }
+});
+});