add drag and drop feature for dependencies

This commit is contained in:
Reinier Balt 2010-02-22 11:35:00 +01:00
parent 32d18857df
commit 8191268821
3 changed files with 43 additions and 0 deletions

View file

@ -24,8 +24,30 @@ Given /^I have ([0-9]+) completed todos$/ do |count|
end
end
Given /^"(.*)" depends on "(.*)"$/ do |successor_name, predecessor_name|
successor = Todo.find_by_description(successor_name)
predecessor = Todo.find_by_description(predecessor_name)
successor.add_predecessor(predecessor)
successor.state = "pending"
successor.save!
end
When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
drag_id = Todo.find_by_description(dragged).id
drop_id = Todo.find_by_description(target).id
drag_name = "xpath=//div[@id='line_todo_#{drag_id}']//img[@class='grip']"
drop_name = "xpath=//div[@id='line_todo_#{drop_id}']//div[@class='description']"
selenium.drag_and_drop_to_object(drag_name, drop_name)
end
Then /^I should see ([0-9]+) todos$/ do |count|
count.to_i.downto 1 do |i|
match_xpath "div["
end
end
Then /^the dependencies of "(.*)" should include "(.*)"$/ do |parent_name, child_name|
parent_id = Todo.find_by_description(parent_name).id
assert_contain(parent_name)
end