diff options
| author | Akash Bhavsar <abh@odoo.com> | 2017-06-26 17:24:01 +0530 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-08-25 15:54:56 +0200 |
| commit | b131e9b0ef458e8cc00b0a2eb6c1b4d8dfe889a0 (patch) | |
| tree | 51589b025dffc424e6e67dfac5c11a35fe88ea42 /addons/web | |
| parent | 7095c32f1cd17a86606e4137ece8baa3034fe74a (diff) | |
[FIX] barcodes: fix several issues when scanning barcodes
Since the new views, most of the barcodes feature was
broken. This commit re-enables the support of commands like
'edit', 'save', 'cancel', 'previous' and 'next'.
Also changed javascript event handler to jquery event handler to
make barcodes testable in phantomjs.
Diffstat (limited to 'addons/web')
| -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 0115dfc9152..f7003faaf5c 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -458,6 +458,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. * @@ -498,6 +512,7 @@ return session.is_bound.then(function () { dragAndDrop: dragAndDrop, triggerMouseEvent: triggerMouseEvent, triggerPositionalMouseEvent: triggerPositionalMouseEvent, + triggerKeypressEvent: triggerKeypressEvent, removeSrcAttribute: removeSrcAttribute, }; }); |
