make todos editable on the search page. Fix #716.

This commit is contained in:
Reinier Balt 2011-09-16 12:38:35 +02:00
parent 83133e3cdc
commit bed46847b3
7 changed files with 153 additions and 17 deletions

View file

@ -0,0 +1,4 @@
When /^I search for "([^"]*)"$/ do |search_arg|
fill_in "search", :with => search_arg
click_button "Search"
end

View file

@ -40,6 +40,12 @@ Given /^I have a todo "([^"]*)"$/ do |description|
Given "I have a todo \"#{description}\" in the context \"Context A\""
end
Given /^I have the following todos:$/ do |table|
table.hashes.each do | todo |
Given "I have a todo \"#{todo[:description]}\" in the context \"#{todo[:context]}\""
end
end
Given /^I have a todo "([^"]*)" with notes "([^"]*)"$/ do |description, notes|
Given "I have a todo \"#{description}\" in the context \"Context A\""
@todo.notes = notes

View file

@ -71,13 +71,46 @@ Then /^I should see the todo "([^\"]*)"$/ do |todo_description|
end
Then /^I should not see the todo "([^\"]*)"$/ do |todo_description|
if selenium.is_element_present("//span[.=\"#{todo_description}\"]")
xpath = "//span[.=\"#{todo_description}\"]"
if selenium.is_element_present(xpath)
wait_for :timeout => 5 do
!selenium.is_element_present("//span[.=\"#{todo_description}\"]")
!selenium.is_element_present(xpath)
end
end
end
Then /^I should see a completed todo "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
# only completed todos have a grey span with the completed_at date
xpath = "//div[@id='line_todo_#{todo.id}']/div/span[@class='grey']"
unless selenium.is_element_present(xpath)
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
selenium.is_visible(xpath).should be_true
end
Then /^I should see an active todo "([^"]*)"$/ do |todo_description|
todo = @current_user.todos.find_by_description(todo_description)
todo.should_not be_nil
# only active todos have a grip div
xpath = "//div[@id='line_todo_#{todo.id}']/img[@class='grip']"
unless selenium.is_element_present(xpath)
wait_for :timeout => 5 do
selenium.is_element_present(xpath)
end
end
selenium.is_visible(xpath).should be_true
end
Then /^the number of actions should be (\d+)$/ do |count|
@current_user.todos.count.should == count.to_i
end