diff options
| author | Christophe Monniez <moc@odoo.com> | 2019-03-23 14:44:07 +0000 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2019-03-25 08:16:24 +0000 |
| commit | 9ea4fefed2f94c6d211951e573b9a9a456f00ce6 (patch) | |
| tree | fe73eca1829725581935381b07735500de446526 /addons/web/static/src/js/tools | |
| parent | d87443a21337bcc3d785ae23e19f66b11ba8bb9e (diff) | |
[FIX] web: avoid click on home menu in community
A fix attempt for the clickEveryWhere test was made in 39e71353c5.
Unfortunately, the last modification of the fix were not tested on the
runbot and introduced two new issues.
1) The click method on the home menu has been changed to use an enhanced
_click function. This function crash when the jquery element is empty.
As this menu does not exists in community, the test miserably fails.
2) A "focus" event was added in the _click function that simulates a real click.
But the "focus" event is not a mouse event and as nothing to do there.
With this commit, the _click function returns immediatly when the
element is empty.
Also, the "focus" event is removed from the _click
simulation but a focus method is used to give focus to the close button.
Giving the focus to the cancel button is itself a fix for the
DateTimePicker field (see 39e7135).
closes odoo/odoo#32082
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/tools')
| -rw-r--r-- | addons/web/static/src/js/tools/test_menus.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js index 694d13d8682..4b7ee4b2e02 100644 --- a/addons/web/static/src/js/tools/test_menus.js +++ b/addons/web/static/src/js/tools/test_menus.js @@ -131,6 +131,7 @@ if ($modal.length > 0) { var $closeButton = $('header > button.close'); if ($closeButton.length > 0) { + $closeButton.focus(); _click($closeButton); } else { $modal.modal('hide'); } isModal = true; @@ -285,11 +286,11 @@ * @param {jQueryElement} $element the element on which to perform the click */ function _click($element) { + if ($element.length == 0) return; triggerMouseEvent($element, "mouseover"); triggerMouseEvent($element, "mouseenter"); triggerMouseEvent($element, "mousedown"); triggerMouseEvent($element, "mouseup"); - triggerMouseEvent($element, "focus"); triggerMouseEvent($element, "click"); function triggerMouseEvent($el, type, count) { |
