+
<%= text_area( "todo", "multiple_todos", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
diff --git a/app/views/todos/create_multiple.js.rjs b/app/views/todos/create_multiple.js.rjs
index b1c310a7..46146a9c 100644
--- a/app/views/todos/create_multiple.js.rjs
+++ b/app/views/todos/create_multiple.js.rjs
@@ -1,5 +1,5 @@
if @saved
- page.hide 'status'
+ page.hide 'multiple_status'
status_message = 'Added new next action'
status_message += 's' if @todos.size > 1
@@ -37,6 +37,14 @@ if @saved
# make sure the behavior of the new/updated todo is enabled
page << "enable_rich_interaction();"
else
- page.show 'status'
- page.replace_html 'status', "#{error_messages_for('todo', :object_name => 'action')}"
+ page.show 'multiple_status'
+ # add error about missing todo description that is not available in @todos
+ @multiple_error = content_tag(:div, content_tag(:p, @multiple_error), {:class => 'errorExplanation', :id => 'errorExplanation'}) unless @multiple_error.blank?
+ error_messages = @multiple_error || ""
+ # add errors of individual @todos
+ @todos.each do |todo|
+ @todo_i = todo
+ error_messages += error_messages_for('todo_i', :object_name => 'action')
+ end
+ page.replace_html 'multiple_status', error_messages
end
\ No newline at end of file
diff --git a/features/shared_add_new_todo.feature b/features/shared_add_new_todo.feature
index 9955e63e..2ad79377 100644
--- a/features/shared_add_new_todo.feature
+++ b/features/shared_add_new_todo.feature
@@ -118,4 +118,20 @@ Feature: Add new next action from every page
| go to | tickler page | not see| 0 | 3 |
| visit | project page for "test project"| see | 3 | 3 |
| visit | context page for "test context"| see | 2 | 3 |
- | visit | tag page for "starred" | not see| 0 | 3 |
\ No newline at end of file
+ | visit | tag page for "starred" | not see| 0 | 3 |
+
+ @selenium
+ 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"
+ And I submit the new multiple actions form with "", "", "", ""
+ Then I should see "You need to submit at least one next action"
+ When I submit the new multiple actions form with "one", "", "", ""
+ Then I should see "Context can't be blank"
+ When I fill the multiple actions form with "", "a project", "a context", "tag"
+ And I submit the new multiple actions form with
+ """
+
+
+ """
+ Then I should see "You need to submit at least one next action"
\ No newline at end of file
diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb
index e1b183f7..d5c8020c 100644
--- a/features/step_definitions/todo_steps.rb
+++ b/features/step_definitions/todo_steps.rb
@@ -76,6 +76,25 @@ When /^I submit multiple actions with using$/ do |multiple_actions|
selenium.click("xpath=//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
end
+When /^I fill the multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags|
+ fill_in "todo[multiple_todos]", :with => descriptions
+ fill_in "multi_todo_project_name", :with => project_name
+ fill_in "multi_todo_context_name", :with => context_name
+ fill_in "multi_tag_list", :with => tags
+end
+
+When /^I submit the new multiple actions form with "([^"]*)", "([^"]*)", "([^"]*)", "([^"]*)"$/ do |descriptions, project_name, context_name, tags|
+ When "I fill the multiple actions form with \"#{descriptions}\", \"#{project_name}\", \"#{context_name}\", \"#{tags}\""
+ selenium.click("xpath=//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
+end
+
+When /^I submit the new multiple actions form with$/ do |multi_line_descriptions|
+ fill_in "todo[multiple_todos]", :with => multi_line_descriptions
+ selenium.click("xpath=//form[@id='todo-form-multi-new-action']//button[@id='todo_multi_new_action_submit']", :wait_for => :ajax, :javascript_framework => :jquery)
+end
+
+
+
Then /^the dependencies of "(.*)" should include "(.*)"$/ do |child_name, parent_name|
parent = @current_user.todos.find_by_description(parent_name)
parent.should_not be_nil
diff --git a/features/step_definitions/todo_tag_steps.rb.rb b/features/step_definitions/todo_tag_steps.rb
similarity index 100%
rename from features/step_definitions/todo_tag_steps.rb.rb
rename to features/step_definitions/todo_tag_steps.rb