diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-08-22 18:54:32 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-08-22 18:54:32 +0200 |
commit | c8a20458c82811b4a329c1f310c08c0ce467b396 (patch) | |
tree | 6dbdd4246c6863862449d02a339d45708ef60700 | |
parent | fdd5177ac3d85bedb7b28f71942d220c9a3edff7 (diff) | |
download | gitlab-ce-c8a20458c82811b4a329c1f310c08c0ce467b396.tar.gz |
Reformat script in DragTo helper
-rw-r--r-- | spec/support/helpers/drag_to_helper.rb | 16 |
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? |