diff options
Diffstat (limited to 'app/assets/javascripts/test_utils/simulate_drag.js')
-rw-r--r-- | app/assets/javascripts/test_utils/simulate_drag.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/test_utils/simulate_drag.js b/app/assets/javascripts/test_utils/simulate_drag.js index 7dba5840c8a..b49f8310c2a 100644 --- a/app/assets/javascripts/test_utils/simulate_drag.js +++ b/app/assets/javascripts/test_utils/simulate_drag.js @@ -55,6 +55,13 @@ ); } + function isLast(target) { + var el = typeof target.el === 'string' ? document.getElementById(target.el.substr(1)) : target.el; + var children = el.children; + + return children.length - 1 === target.index; + } + function getRect(el) { var rect = el.getBoundingClientRect(); var width = rect.right - rect.left; @@ -88,6 +95,10 @@ options.ontap && options.ontap(); window.SIMULATE_DRAG_ACTIVE = 1; + if (isLast(options.to)) { + toRect.cy += 100; + } + var dragInterval = setInterval(function loop() { var progress = (new Date().getTime() - startTime) / duration; var x = (fromRect.cx + (toRect.cx - fromRect.cx) * progress) - scrollable.scrollLeft; |