summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-08-22 18:54:32 +0200
committerWinnie Hellmann <winnie@gitlab.com>2019-08-22 18:54:32 +0200
commitc8a20458c82811b4a329c1f310c08c0ce467b396 (patch)
tree6dbdd4246c6863862449d02a339d45708ef60700
parentfdd5177ac3d85bedb7b28f71942d220c9a3edff7 (diff)
downloadgitlab-ce-c8a20458c82811b4a329c1f310c08c0ce467b396.tar.gz
Reformat script in DragTo helper
-rw-r--r--spec/support/helpers/drag_to_helper.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/support/helpers/drag_to_helper.rb b/spec/support/helpers/drag_to_helper.rb
index 6099f87323f..6883f8afe8b 100644
--- a/spec/support/helpers/drag_to_helper.rb
+++ b/spec/support/helpers/drag_to_helper.rb
@@ -2,7 +2,21 @@
module DragTo
def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body', duration: 1000)
- evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), duration: #{duration}, from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});")
+ js = <<~JS
+ simulateDrag({
+ scrollable: $('#{scrollable}').get(0),
+ duration: #{duration},
+ from: {
+ el: $('#{selector}').eq(#{list_from_index}).get(0),
+ index: #{from_index}
+ },
+ to: {
+ el: $('#{selector}').eq(#{list_to_index}).get(0),
+ index: #{to_index}
+ }
+ });
+ JS
+ evaluate_script(js)
Timeout.timeout(Capybara.default_max_wait_time) do
loop while drag_active?