make adding of todos from sidebar work in context and project grouping

This commit is contained in:
Reinier Balt 2013-04-11 10:53:35 +02:00
parent 783d4dd774
commit 9c0445fcb7
17 changed files with 528 additions and 389 deletions

View file

@ -98,7 +98,7 @@ end
####### Project #######
Then /^I should not see "([^"]*)" in the project container of "([^"]*)"$/ do |todo_description, project_name|
Then /^I should (see|not see) "([^"]*)" in the project container of "([^"]*)"$/ do |visible, todo_description, project_name|
todo = @current_user.todos.where(:description => todo_description).first
todo.should_not be_nil
@ -106,30 +106,20 @@ Then /^I should not see "([^"]*)" in the project container of "([^"]*)"$/ do |to
project.should_not be_nil
xpath = "//div[@id='p#{todo.project.id}_items']//div[@id='line_todo_#{todo.id}']"
page.should_not have_xpath(xpath)
page.send( visible=='see' ? :should : :should_not, have_xpath(xpath))
end
Then /^I should see "([^"]*)" in project container for "([^"]*)"$/ do |todo_description, project_name|
todo = @current_user.todos.where(:description => todo_description).first
todo.should_not be_nil
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
xpath = "//div[@id='p#{project.id}_items']//div[@id='line_todo_#{todo.id}']"
page.should have_xpath(xpath)
end
Then(/^I should see "(.*?)" in the project container for "(.*?)"$/) do |todo_description, project_name|
step "I should see \"#{todo_description}\" in project container for \"#{project_name}\""
end
Then /^I should not see the project container for "([^"]*)"$/ do |project_name|
Then(/^I should (see|not see) the project container for "([^"]*)"$/) do |visible, project_name|
project = @current_user.projects.where(:name => project_name).first
project.should_not be_nil
xpath = "//div[@id='p#{project.id}']"
page.should_not have_xpath(xpath, :visible => true)
page.send( visible=='see' ? :should : :should_not, have_xpath(xpath, :visible => true))
end
Then(/^the container for the project "(.*?)" should (be visible|not be visible)$/) do |project_name, visible|
map = { "be visible" => "see", "not be visible" => "not see"}
step("I should #{map[visible]} the project container for \"#{project_name}\"")
end
####### Completed #######

View file

@ -15,8 +15,8 @@ Given /^the date is "(.*?)"$/ do |date|
Timecop.travel(date)
end
Given(/^I have selected the view for group by project$/) do
@group_view_by='projects'
Given(/^I have selected the view for group by (project|context)$/) do |grouping|
@group_view_by = grouping
end
Then /the badge should show (.*)/ do |number|

View file

@ -203,6 +203,23 @@ When /^I submit a new action with description "([^"]*)"$/ do |description|
submit_next_action_form
end
When /^I submit a new action with description "([^"]*)" in the project "(.*?)"$/ do |description, project_name|
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
fill_in "project_name", :with => project_name
end
submit_next_action_form
end
When(/^I submit a new action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)"$/) do |description, project_name, tags|
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
fill_in "project_name", :with => project_name
fill_in "tag_list", :with => tags
end
submit_next_action_form
end
When /^I submit a new action with description "([^"]*)" with a dependency on "([^"]*)"$/ do |todo_description, predecessor_description|
predecessor = @current_user.todos.where(:description => predecessor_description).first
predecessor.should_not be_nil
@ -287,6 +304,16 @@ When /^I submit a new deferred action with description "([^"]*)" and the tags "(
submit_next_action_form
end
When(/^I submit a new deferred action with description "([^"]*)" to project "(.*?)" with tags "([^"]*)"$/) do |description, project_name, tags|
within "form#todo-form-new-action" do
fill_in "todo[description]", :with => description
fill_in "todo_project_name", :with => project_name
fill_in "tag_list", :with => tags
fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week)
end
submit_next_action_form
end
When /^I submit a new deferred action with description "([^"]*)" to project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |description, project_name, tags, context_name|
fill_in "todo[description]", :with => description