diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-08-28 14:49:11 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-08-28 14:49:11 +0200 |
| commit | d0f132b297e88cc79251a9ddf1a2deb66de415ac (patch) | |
| tree | 30e5f946334aff4c0b116ff96ac4258542bcaad4 /addons/web/static/tests/helpers/test_utils.js | |
| parent | b3b6267cf001b04ec0aae1573d47f16070803715 (diff) | |
| parent | 4ac347735d4de252678b557afab7cac3c3eb75de (diff) | |
[MERGE] forward port branch saas-16 up to 4ac347735d4
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils.js')
| -rw-r--r-- | addons/web/static/tests/helpers/test_utils.js | 15 |
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 5601f93f202..e2007106ecd 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -469,6 +469,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. * @@ -509,6 +523,7 @@ return session.is_bound.then(function () { dragAndDrop: dragAndDrop, triggerMouseEvent: triggerMouseEvent, triggerPositionalMouseEvent: triggerPositionalMouseEvent, + triggerKeypressEvent: triggerKeypressEvent, removeSrcAttribute: removeSrcAttribute, }; }); |
