[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.
This commit is contained in:
len-odoo
2018-07-31 16:18:26 +02:00
committed by len-odoo
parent c75f4fbcd1
commit e57a1a8e6f
@@ -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') {