summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils.js
diff options
context:
space:
mode:
authorlen-odoo <len@odoo.com>2018-07-27 15:38:23 +0200
committerlen-odoo <35492570+len-odoo@users.noreply.github.com>2018-07-31 16:18:26 +0200
commite57a1a8e6f6b79e3bb369d88eee295bb5a7788f3 (patch)
tree71dbbad84f13bf9eb4506588b4146d3508727930 /addons/web/static/tests/helpers/test_utils.js
parentc75f4fbcd121bfb21ce6221b0d810cc55e814d9b (diff)
[FIX] web: fix 'drag and drop' test function to work in both directions
The 'drag and drop' function defined in test_utils should be aware of four different cases, moving up or down, above or below another row. We need an offset of one pixel for the function to work when moving down (this is a case of broken symmetry because of <=) Related to opw 1867049 regarding sequences of resequence moves.
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js
index c2828802891..fc26aa80713 100644
--- a/addons/web/static/tests/helpers/test_utils.js
+++ b/addons/web/static/tests/helpers/test_utils.js
@@ -414,10 +414,11 @@ function dragAndDrop($el, $to, options) {
var toOffset = $to.offset();
toOffset.top += $to.outerHeight()/2;
toOffset.left += $to.outerWidth()/2;
+ var vertical_offset = (toOffset.top < elementCenter.top) ? -1 : 1;
if (position === 'top') {
- toOffset.top -= $to.outerHeight()/2;
+ toOffset.top -= $to.outerHeight()/2 + vertical_offset;
} else if (position === 'bottom') {
- toOffset.top += $to.outerHeight()/2;
+ toOffset.top += $to.outerHeight()/2 - vertical_offset;
} else if (position === 'left') {
toOffset.left -= $to.outerWidth()/2;
} else if (position === 'right') {