From 426b0fca20c378ab583cd6deb52240b6b97ba46e Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Mon, 25 May 2015 11:57:10 +0200 Subject: [PATCH] also update default_context_name New actions are created with the context as defined in default_context_name. This value needs to be updated as shown in #1789. --- app/views/contexts/update.js.erb | 2 +- features/context_edit.feature | 8 ++++++++ features/step_definitions/context_steps.rb | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/contexts/update.js.erb b/app/views/contexts/update.js.erb index cf0ae85f..0b7b89ca 100644 --- a/app/views/contexts/update.js.erb +++ b/app/views/contexts/update.js.erb @@ -18,7 +18,7 @@ var <%=object_name%> = { <% else -%> <%=object_name%>.replace_context_form_with_updated_context(); <% end -%> - TracksForm.set_context_name("<%= escape_javascript(@context.name)%>"); + TracksForm.set_context_name_and_default_context_name("<%= escape_javascript(@context.name)%>"); }, remove_and_re_add_context: function() { $('#<%=dom_id(@context, 'container')%>').slideUp(500, function() { diff --git a/features/context_edit.feature b/features/context_edit.feature index 91cdfd24..6a3a1e4a 100644 --- a/features/context_edit.feature +++ b/features/context_edit.feature @@ -28,6 +28,14 @@ Feature: Edit a context And I edit the context name in place to be "OutAndAbout" Then the context field of the new todo form should contain "OutAndAbout" + # Ticket #1789 + @javascript + Scenario: I can change the name of the context and it should still allow me to add new actions + When I go to the context page for "@pc" + And I edit the context name in place to be "OutAndAbout" + And I submit a new action with description "a new next action" + Then I should see the todo "a new next action" + @javascript Scenario: Editing the context of a todo will remove the todo When I go to the the context page for "@pc" diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb index 6d4719a5..e1c05153 100644 --- a/features/step_definitions/context_steps.rb +++ b/features/step_definitions/context_steps.rb @@ -54,6 +54,7 @@ When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name| page.find("span#context_name").click fill_in "value", :with => new_context_name click_button "Ok" + wait_for_ajax end Then /^I should see the context name is "([^\"]*)"$/ do |context_name|