Make simulateDrag duration configurable
This commit is contained in:
parent
dfebcc7a84
commit
6d2fedf74f
2 changed files with 6 additions and 5 deletions
|
@ -35,7 +35,7 @@ describe 'Issue Boards', :js do
|
|||
end
|
||||
|
||||
it 'moves un-ordered issue to top of list' do
|
||||
drag(from_index: 3, to_index: 0)
|
||||
drag(from_index: 3, to_index: 0, duration: 1180)
|
||||
|
||||
wait_for_requests
|
||||
|
||||
|
@ -156,12 +156,13 @@ describe 'Issue Boards', :js do
|
|||
end
|
||||
end
|
||||
|
||||
def drag(selector: '.board-list', list_from_index: 1, from_index: 0, to_index: 0, list_to_index: 1)
|
||||
def drag(selector: '.board-list', list_from_index: 1, from_index: 0, to_index: 0, list_to_index: 1, duration: 1000)
|
||||
drag_to(selector: selector,
|
||||
scrollable: '#board-app',
|
||||
list_from_index: list_from_index,
|
||||
from_index: from_index,
|
||||
to_index: to_index,
|
||||
list_to_index: list_to_index)
|
||||
list_to_index: list_to_index,
|
||||
duration: duration)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module DragTo
|
||||
def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body')
|
||||
evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});")
|
||||
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}}});")
|
||||
|
||||
Timeout.timeout(Capybara.default_max_wait_time) do
|
||||
loop while drag_active?
|
||||
|
|
Loading…
Reference in a new issue