summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-08-31 12:55:41 +0200
committerChristophe Simonis <chs@odoo.com>2017-08-31 12:55:41 +0200
commit4879ce040797fd4a47b6b8326c3aacd365c8ab91 (patch)
tree45479b47c5dcfba0d0ced4f05d770b0852f31263 /addons/web/static/tests/helpers/test_utils.js
parentdae6178a0a5629ce678b20fcc9226caa44a5b0ce (diff)
parentfe77df3ba480d40b3d6b25736397bd52c684ce03 (diff)
[MERGE] forward port branch saas-17 up to fe77df3ba48
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js
index fdc70507a12..65cbc16fda0 100644
--- a/addons/web/static/tests/helpers/test_utils.js
+++ b/addons/web/static/tests/helpers/test_utils.js
@@ -470,6 +470,20 @@ function triggerPositionalMouseEvent(x, y, type){
}
/**
+ * simulate a keypress event for a given character
+ * @param {string} the character
+ */
+function triggerKeypressEvent(char) {
+ var keycode;
+ if (char === "Enter") {
+ keycode = $.ui.keyCode.ENTER;
+ } else {
+ keycode = char.charCodeAt(0);
+ }
+ return $('body').trigger($.Event('keypress', {which: keycode, keyCode: keycode}));
+}
+
+/**
* Removes the src attribute on images and iframes to prevent not found errors,
* and optionally triggers an rpc with the src url as route on a widget.
*
@@ -518,6 +532,7 @@ return $.when(
dragAndDrop: dragAndDrop,
triggerMouseEvent: triggerMouseEvent,
triggerPositionalMouseEvent: triggerPositionalMouseEvent,
+ triggerKeypressEvent: triggerKeypressEvent,
removeSrcAttribute: removeSrcAttribute,
};
});