finish cucumber scenario for calendar

This commit is contained in:
Reinier Balt 2011-03-02 08:44:34 +01:00
parent 75cf51927e
commit 668ef4fb23
4 changed files with 14 additions and 6 deletions

View file

@ -903,7 +903,7 @@ class TodosController < ApplicationController
@target_context_count = current_user.projects.find(@todo.project_id).todos.active.count
}
from.calendar {
@target_context_count = count_old_due_empty(@new_due_id)
@target_context_count = @new_due_id.blank? ? 0 : count_old_due_empty(@new_due_id)
}
end
@remaining_in_context = current_user.contexts.find(context_id).todos(true).active.not_hidden.count if !@remaining_in_context

View file

@ -24,7 +24,8 @@ Feature: Show all due actions in a calendar view
@selenium @wip
Scenario: Clearing the due date of a todo will remove it from the calendar
When I submit a new action with description "a new next action" in the context "@calendar"
When I go to the home page
And I submit a new action with description "a new next action" in the context "@calendar"
And I edit the due date of "a new next action" to tomorrow
And I go to the calendar page
Then I should see "a new next action"

View file

@ -94,11 +94,14 @@ When /I change the (.*) field of "([^\"]*)" to "([^\"]*)"$/ do |field, todo_name
todo = @current_user.todos.find_by_description(todo_name)
todo.should_not be_nil
selenium.click("//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
#selenium.click("//img[@id='edit_icon_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
open_edit_form_for(todo)
selenium.type("css=form.edit_todo_form input[name=#{field}]", new_value)
selenium.click("css=button.positive", :wait_for => :ajax, :javascript_framework => :jquery)
#selenium.click("css=button.positive", :wait_for => :ajax, :javascript_framework => :jquery)
submit_edit_todo_form(todo)
# TODO: change to a wait_for
sleep(5)
sleep(1)
end
When /^I submit a new action with description "([^"]*)"$/ do |description|
@ -192,7 +195,7 @@ When /^I clear the due date of "([^"]*)"$/ do |action_description|
todo = @current_user.todos.find_by_description(action_description)
todo.should_not be_nil
open_edit_form_for(todo)
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo_id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
selenium.click("//div[@id='edit_todo_#{todo.id}']//a[@id='due_x_todo_#{todo.id}']/img", :wait_for => :ajax, :javascript_framework => :jquery)
submit_edit_todo_form(todo)
end

View file

@ -5,6 +5,7 @@ module TracksStepHelper
def submit_next_action_form
selenium.click("xpath=//form[@id='todo-form-new-action']//button[@id='todo_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
sleep(1)
end
def submit_new_context_form
@ -17,6 +18,9 @@ module TracksStepHelper
def submit_edit_todo_form (todo)
selenium.click("//div[@id='edit_todo_#{todo.id}']//button[@id='submit_todo_#{todo.id}']", :wait_for => :ajax, :javascript_framework => :jquery)
wait_for do
!selenium.is_element_present("//form[@id='form_todo_#{todo.id}']")
end
end
def format_date(date)