diff --git a/app/views/contexts/_context_listing.rhtml b/app/views/contexts/_context_listing.rhtml
index cde76c9a..b98a0f51 100644
--- a/app/views/contexts/_context_listing.rhtml
+++ b/app/views/contexts/_context_listing.rhtml
@@ -23,18 +23,6 @@ suppress_edit_button ||= false
<%= link_to_delete_context(context, image_tag( "blank.png", :title => t('contexts.delete_context'), :class=>"delete_item")) %>
<%= suppress_edit_button ? "" : link_to_edit_context(context, image_tag( "blank.png", :title => t('contexts.edit_context'), :class=>"edit_item")) %>
- <% # = # link_to_remote(
- #image_tag( "blank.png", :title => "Delete context", :class=>"delete_item"),
- #:url => {:controller => 'contexts', :action => 'destroy', :id => context.id},
- #:method => 'delete',
- #:with => "'_source_view=#{@source_view}'",
- #:before => "$('#{dom_id(context)}').block({message:null});",
- #:complete => "$('#{dom_id(context)}').unblock();",
- #:confirm => "Are you sure that you want to delete the context '#{context.name}'? Be aware that this will also delete all (repeating) actions in this context!",
- #:html => { :id => dom_id(context, 'delete') }
- #)
- %>
-
diff --git a/app/views/projects/update.js.erb b/app/views/projects/update.js.erb
index 73f2072d..9836efa9 100644
--- a/app/views/projects/update.js.erb
+++ b/app/views/projects/update.js.erb
@@ -1,6 +1,6 @@
<% if @saved -%>
- pageNotify('notice', '<%=t('projects.project_saved_status')%>', 5);
+ page_notify('notice', '<%=t('projects.project_saved_status')%>', 5);
<% if source_view_is :project_list -%>
@@ -10,10 +10,11 @@
replace_project_form_with_updated_project();
<% end -%>
- ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>)
+ ProjectListPage.update_all_states_count(<%=@active_projects_count%>, <%=@hidden_projects_count%>, <%=@completed_projects_count%>);
ProjectListPage.show_or_hide_all_state_containers(<%= @show_active_projects %>, <%= @show_hidden_projects %>, <%= @show_completed_projects %>);
- <% else # assume source_view :project %>
+ <% else # assume source_view :project
+ -%>
remove_project_edit_form();
update_and_show_project_settings();
@@ -53,7 +54,7 @@ function update_and_show_project_settings() {
}
function update_sidebar() {
- $('#sidebar').html();
+ $('#sidebar').html(html_for_sidebar());
}
function replace_project_form_with_updated_project() {
diff --git a/features/project_edit.feature b/features/project_edit.feature
index 2b2f139e..b9ee5b1a 100644
--- a/features/project_edit.feature
+++ b/features/project_edit.feature
@@ -52,7 +52,7 @@ Feature: Edit a project
When I go to the projects page
Then the badge should show 2 # "manage me" and "test"
When I visit the "manage me" project
- And I edit the project name to "test"
+ And I try to edit the project name to "test"
Then I should see "Name already exists"
# Ticket #1042
@@ -61,7 +61,7 @@ Feature: Edit a project
Given I have a project "test" with 1 todos
When I go to the projects page
Then the badge should show 2 # "manage me" and "test"
- When I edit the project name of "manage me" to "test"
+ When I try to edit the project name of "manage me" to "test"
Then I should see "Name already exists"
# No scenario is needed for adding a todo to the project. This is covered in
diff --git a/features/step_definitions/context_list_steps.rb b/features/step_definitions/context_list_steps.rb
index f3a6304c..e808ceac 100644
--- a/features/step_definitions/context_list_steps.rb
+++ b/features/step_definitions/context_list_steps.rb
@@ -23,7 +23,7 @@ When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
:timeout => 5
wait_for do
- selenium.is_element_present("edit_context_#{@context.id}")
+ !selenium.is_element_present("submit_context_#{@context.id}")
end
end
diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb
index fb33dd6a..35f5a35b 100644
--- a/features/step_definitions/context_steps.rb
+++ b/features/step_definitions/context_steps.rb
@@ -13,7 +13,6 @@ Given /^there exists a context called "([^"]*)" for user "([^"]*)"$/ do |context
Given "there exists an active context called \"#{context_name}\" for user \"#{login}\""
end
-
Given /^there exists a hidden context called "([^"]*)" for user "([^"]*)"$/ do |context_name, login|
user = User.find_by_login(login)
user.should_not be_nil
@@ -65,46 +64,6 @@ When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name|
click_button "OK"
end
-When /^I delete the context "([^\"]*)"$/ do |context_name|
- context = @current_user.contexts.find_by_name(context_name)
- context.should_not be_nil
- click_link "delete_context_#{context.id}"
- selenium.get_confirmation.should == "Are you sure that you want to delete the context '#{context_name}'? Be aware that this will also delete all (repeating) actions in this context!"
- wait_for do
- !selenium.is_element_present("delete_context_#{context.id}")
- end
-end
-
-When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
- click_link "edit_context_#{@context.id}"
-
- wait_for do
- selenium.is_element_present("submit_context_#{@context.id}")
- end
-
- fill_in "context_name", :with => new_name
-
- selenium.click "submit_context_#{@context.id}",
- :wait_for => :text,
- :element => "flash",
- :text => "Context saved"
-
- wait_for do
- selenium.is_element_present("edit_context_#{@context.id}")
- end
-end
-
-When /^I add a new context "([^"]*)"$/ do |context_name|
- fill_in "context[name]", :with => context_name
- submit_new_context_form
-end
-
-When /^I add a new hidden context "([^"]*)"$/ do |context_name|
- fill_in "context[name]", :with => context_name
- check "context_hide"
- submit_new_context_form
-end
-
Then /^I should see the context name is "([^\"]*)"$/ do |context_name|
Then "I should see \"#{context_name}\""
end
diff --git a/features/step_definitions/project_list_steps.rb b/features/step_definitions/project_list_steps.rb
index e060f501..2ab5c737 100644
--- a/features/step_definitions/project_list_steps.rb
+++ b/features/step_definitions/project_list_steps.rb
@@ -45,6 +45,7 @@ end
When /^I sort the list by number of tasks$/ do
click_link "By number of tasks"
+ selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery
selenium.get_confirmation.should == "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order."
end
diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb
index 95ddfc56..96335e07 100644
--- a/features/step_definitions/project_steps.rb
+++ b/features/step_definitions/project_steps.rb
@@ -42,17 +42,36 @@ end
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
click_link "link_edit_project_#{@project.id}"
- selenium.wait_for_element("xpath=//div[@id='edit_project_#{@project.id}']/form//button[@id='submit_project_#{@project.id}']")
+
+ wait_for do
+ selenium.is_element_present("submit_project_#{@project.id}")
+ end
fill_in "project[name]", :with => new_title
- # changed to make sure selenium waits until the saving has a result either
- # positive or negative. Was: :element=>"flash", :text=>"Project saved"
- # we may need to change it back if you really need a positive outcome, i.e.
- # this step needs to fail if the project was not saved successfully
selenium.click "submit_project_#{@project.id}",
:wait_for => :text,
- :text => /(Project saved|1 error prohibited this project from being saved)/
+ :text => "Project saved",
+ :timeout => 5
+
+ wait_for do
+ !selenium.is_element_present("submit_context_#{@project.id}")
+ end
+end
+
+When /^I try to edit the project name to "([^\"]*)"$/ do |new_title|
+ click_link "link_edit_project_#{@project.id}"
+
+ wait_for do
+ selenium.is_element_present("submit_project_#{@project.id}")
+ end
+
+ fill_in "project[name]", :with => new_title
+
+ selenium.click "submit_project_#{@project.id}",
+ :wait_for => :text,
+ :text => "There were problems with the following fields:",
+ :timeout => 5
end
When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
@@ -61,6 +80,13 @@ When /^I edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_n
When "I edit the project name to \"#{project_new_name}\""
end
+When /^I try to edit the project name of "([^"]*)" to "([^"]*)"$/ do |project_current_name, project_new_name|
+ @project = @current_user.projects.find_by_name(project_current_name)
+ @project.should_not be_nil
+ When "I try to edit the project name to \"#{project_new_name}\""
+end
+
+
When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name|
selenium.click "project_name"
fill_in "value", :with => new_project_name