fix #1123 and fix #1124 and refactor drag and drop a bit

This commit is contained in:
Reinier Balt 2011-03-11 21:01:24 +01:00
parent 15a2eb6f08
commit bc73b18bed
9 changed files with 364 additions and 311 deletions

View file

@ -1,6 +1,6 @@
Feature: dependencies
As a Tracks user
In order to keep track of complex todos
In order to keep track of complex todos that are dependent on each other
I want to assign and manage todo dependencies
Background:
@ -94,3 +94,16 @@ Feature: dependencies
Scenario: Deleting a successor will update predecessor
Given this is a pending scenario
@selenium @wip
Scenario: Dragging an action to a completed action will not add it as a dependency
Given I have a context called "@pc"
And I have a project "dependencies" that has the following todos
| description | context | completed |
| test 1 | @pc | no |
| test 2 | @pc | no |
| test 3 | @pc | yes |
When I visit the "dependencies" project
And I drag "test 1" to "test 3"
Then I should see an error flash message saying "Cannot add this action as a dependency to a completed action!"
And I should see "test 1" in project container for "dependencies"

View file

@ -15,8 +15,7 @@ When /^I drag "(.*)" to "(.*)"$/ do |dragged, target|
selenium.drag_and_drop_to_object(drag_name, drop_name)
arrow = "xpath=//div[@id='line_todo_#{drop_id}']/div/a[@class='show_successors']/img"
selenium.wait_for_element(arrow, :timeout_in_seconds => 5)
wait_for_ajax
end
When /^I expand the dependencies of "([^\"]*)"$/ do |todo_name|

View file

@ -34,3 +34,34 @@ Then /^I should not see the context "([^"]*)"$/ do |context_name|
!selenium.is_visible("xpath=//div[@id='c#{context.id}']")
end
end
Then /^I should see an error flash message saying "([^"]*)"$/ do |message|
xpath = "//div[@id='message_holder']/h4[@id='flash']"
text = response.selenium.get_text("xpath=#{xpath}")
text.should == message
end
Then /^I should see "([^"]*)" in context container for "([^"]*)"$/ do |todo_description, context_name|
context = @current_user.contexts.find_by_name(context_name)
context.should_not be_nil
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
xpath = "xpath=//div[@id=\"c#{context.id}\"]//div[@id='line_todo_#{todo.id}']"
selenium.wait_for_element(xpath, :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
end
Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_description, project_name|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
project = @current_user.projects.find_by_name(project_name)
project.should_not be_nil
xpath = "//div[@id='p#{project.id}items']//div[@id='line_todo_#{todo.id}']"
selenium.wait_for_element("xpath=#{xpath}", :timeout_in_seconds => 5)
selenium.is_visible(xpath).should be_true
end

View file

@ -65,6 +65,9 @@ Given /^I have a project "([^"]*)" that has the following todos$/ do |project_na
unless todo[:tags].nil?
new_todo.tag_with(todo[:tags])
end
unless todo[:completed].nil?
new_todo.complete! if todo[:completed] == 'yes'
end
end
end