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

@ -57,7 +57,7 @@ Feature: dependencies
Then I should not see "test 1" within the dependencies of "test 2"
And I should not see "test 1" in the deferred container
@javascript @wip
@javascript
Scenario: Completing a predecessor will activate successors
Given I have a context called "@pc"
And I have a project "dependencies" that has the following todos

View file

@ -85,21 +85,26 @@ Feature: Add new next action from every page
@javascript
Scenario Outline: I can add a todo from several pages
Given I have selected the view for group by <grouping>
When I go to the <page>
And I submit a new action with description "a new next action"
And I submit a new action with description "a new next action"
Then I should <see> the todo "a new next action"
Scenarios:
| page | see |
| home page | see |
| tickler page | not see |
| "test project" project | see |
| context page for "test context" | see |
| tag page for "starred" | see |
| page | grouping | see |
| home page | context | see |
| home page | project | see |
| tickler page | context | not see |
| tickler page | project | not see |
| "test project" project | context | see |
| context page for "test context" | context | see |
| tag page for "starred" | context | see |
| tag page for "starred" | project | see |
@javascript
Scenario Outline: I can add multiple todos from several pages
Given I have a project "testing" with 1 todos
And I have selected the view for group by <grouping>
When I go to the <page>
And I follow "Add multiple next actions"
And I submit multiple actions with using
@ -113,15 +118,18 @@ Feature: Add new next action from every page
And the number of actions should be <count>
Scenarios:
| page | see | badge | count |
| home page | see | 3 | 3 |
| tickler page | not see | 0 | 3 |
| "testing" project | see | 3 | 3 |
| context page for "test context" | see | 2 | 3 |
| tag page for "starred" | not see | 0 | 3 |
| page | see | badge | count | grouping |
| home page | see | 3 | 3 | context |
| home page | see | 3 | 3 | project |
| tickler page | not see | 0 | 3 | context |
| tickler page | not see | 0 | 3 | project |
| "testing" project | see | 3 | 3 | context |
| context page for "test context" | see | 2 | 3 | context |
| tag page for "starred" | see | 2 | 3 | context |
| tag page for "starred" | see | 2 | 3 | project |
@javascript
Scenario: Adding a todo to another project does not show the todo
Scenario: Adding a todo to another project does not show the todo in project view
Given I have a project called "another project"
When I go to the "test project" project
And I submit a new action with description "can you see me?" to project "another project" in the context "test context"
@ -140,7 +148,7 @@ Feature: Add new next action from every page
Then I should see the todo "another new next action"
@javascript
Scenario Outline: Adding a todo with a new context shows the new context
Scenario Outline: Adding a todo with a new context shows the new context when page groups todos by context
When I go to the <page>
And I submit a new <todo> with description "do at new context" and the tags "starred" in the context "New"
Then a confirmation for adding a new context "New" should be asked
@ -155,12 +163,29 @@ Feature: Add new next action from every page
| context page for "test context" | action | 1 | not be visible |
| tag page for "starred" | action | 1 | be visible |
@javascript
Scenario Outline: Adding a todo with a new project shows the new project when page groups todos by project
And I have selected the view for group by project
When I go to the <page>
And I submit a new <todo> with description "do in new project" to project "New" with tags "starred"
Then the container for the project "New" should <visible>
And the badge should show <badge>
Scenarios:
| page | todo | badge | visible |
| home page | action | 1 | be visible |
| tickler page | deferred action | 1 | be visible |
| "test project" project | action | 1 | not be visible |
| context page for "test context" | action | 1 | not be visible |
| tag page for "starred" | action | 1 | be visible |
@javascript
Scenario Outline: Adding a todo to a hidden project does not show the todo
Given I have a hidden project called "hidden project"
And I have a project called "visible project"
And I have a context called "visible context"
And I have a context called "other context"
And I have selected the view for group by <grouping>
When I go to the <page>
And I submit a new action with description "hidden todo" to project "hidden project" with tags "test" in the context "visible context"
Then I should <see_hidden> "hidden todo"
@ -168,17 +193,21 @@ Feature: Add new next action from every page
Then I should <see_visible> "visible todo"
Scenarios:
| page | see_hidden | see_visible |
| home page | not see | see |
| tickler page | not see | not see |
| "visible project" project | not see | see |
| "hidden project" project | see | not see |
| context page for "visible context" | not see | see |
| context page for "other context" | not see | not see |
| tag page for "starred" | not see | not see |
| tag page for "test" | see | see |
| page | grouping | see_hidden | see_visible |
| home page | context | not see | see |
| home page | project | not see | see |
| tickler page | context | not see | not see |
| tickler page | project | not see | not see |
| "visible project" project | project | not see | see |
| "hidden project" project | project | see | not see |
| context page for "visible context" | context | not see | see |
| context page for "other context" | context | not see | not see |
| tag page for "starred" | context | not see | not see |
| tag page for "starred" | project | not see | not see |
| tag page for "test" | context | see | see |
| tag page for "test" | project | see | see |
@javascript
@javascript
Scenario: Adding a todo to a hidden context from home page does not show the todo
Given I have a context called "visible context"
And I have a hidden context called "hidden context"
@ -200,14 +229,21 @@ Feature: Add new next action from every page
Then I should see "another new todo"
@javascript
Scenario: Adding a todo to an empty container hides the empty message # TODO: make outline
Scenario Outline: Adding a todo to an empty container hides the empty message
Given I have a context called "visible context"
And I have a project called "visible project"
And I have selected the view for group by <grouping>
When I go to the tag page for "test"
Then I should see empty message for todos of tag
When I submit a new action with description "a new todo" and the tags "test" in the context "visible context"
When I submit a new action with description "a new todo" to project "visible project" with tags "test" in the context "visible context"
Then I should see "a new todo"
And I should not see empty message for todos of tag
Scenarios:
| grouping |
| context |
| project |
@javascript
Scenario Outline: Adding a dependency to a todo updates the successor
Given I have a <list_type> "test" with 1 todos
@ -224,7 +260,7 @@ Feature: Add new next action from every page
| project |
| context |
@javascript
@javascript
Scenario: Adding a dependency to a todo in another project
Given I have a project "testing" with 1 todos
And I have a project "another project"
@ -233,8 +269,9 @@ Feature: Add new next action from every page
Then I should not see "a new todo" in the project container of "another project"
And I should not see empty message for deferred todos of project
@javascript
Scenario: I can add multiple todos in a new project and a new context
@javascript @wip
Scenario Outline: I can add multiple todos in a new project and a new context
Given I have selected the view for group by <grouping>
When I go to the home page
And I follow "Add multiple next actions"
And I fill the multiple actions form with "", "a next project", "@anywhere", "new tag"
@ -253,7 +290,13 @@ Feature: Add new next action from every page
And I should see "b"
And I should see "c"
@javascript
Scenarios:
| grouping |
| project |
| context |
@javascript
Scenario: I need to fill in at least one description and a context
When I go to the home page
And I follow "Add multiple next actions"

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

View file

@ -9,7 +9,7 @@ module NavigationHelpers
options = {}
options[:format] = :m if @mobile_interface
options[:locale] = @locale if @locale
options[:group_view_by] = @group_view_by if @group_view_by
options[:_group_view_by] = @group_view_by if @group_view_by
@source_view = nil
case page_name