mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-15 00:36:33 +01:00
get drag and drop for projects running
This commit is contained in:
parent
cde8ad35fd
commit
af80861725
7 changed files with 56 additions and 22 deletions
|
|
@ -9,6 +9,31 @@ When /^I delete project "([^"]*)"$/ do |project_name|
|
|||
end
|
||||
end
|
||||
|
||||
When /^I drag the project "([^"]*)" below "([^"]*)"$/ do |project_drag, project_drop|
|
||||
drag_id = @current_user.projects.find_by_name(project_drag).id
|
||||
drop_id = @current_user.projects.find_by_name(project_drop).id
|
||||
|
||||
container_height = selenium.get_element_height("//div[@id='container_project_#{drag_id}']").to_i
|
||||
vertical_offset = container_height*2
|
||||
coord_string = "10,#{vertical_offset}"
|
||||
|
||||
drag_project_handle_xpath = "//div[@id='project_#{drag_id}']//span[@class='handle']"
|
||||
drop_project_container_xpath = "//div[@id='container_project_#{drop_id}']"
|
||||
|
||||
selenium.mouse_down_at(drag_project_handle_xpath,"2,2")
|
||||
selenium.mouse_move_at(drop_project_container_xpath,coord_string)
|
||||
# selenium.mouse_over(drop_project_container_xpath)
|
||||
selenium.mouse_up_at(drop_project_container_xpath,coord_string)
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" should be above the project "([^"]*)"$/ do |project_high, project_low|
|
||||
high_id = @current_user.projects.find_by_name(project_high).id
|
||||
low_id = @current_user.projects.find_by_name(project_low).id
|
||||
high_pos = selenium.get_element_position_top("//div[@id='project_#{high_id}']").to_i
|
||||
low_pos = selenium.get_element_position_top("//div[@id='project_#{low_id}']").to_i
|
||||
(high_pos < low_pos).should be_true
|
||||
end
|
||||
|
||||
Then /^the project "([^"]*)" should not be in state list "([^"]*)"$/ do |project_name, state_name|
|
||||
project = @current_user.projects.find_by_name(project_name)
|
||||
project.should_not be_nil
|
||||
|
|
@ -24,5 +49,5 @@ Then /^the project "([^"]*)" should be in state list "([^"]*)"$/ do |project_nam
|
|||
end
|
||||
|
||||
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
|
||||
selenium.get_text("css=span##{state_name}-projects-count").should == count
|
||||
selenium.get_text("xpath=//span[@id='#{state_name}-projects-count']").should == count
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue