update form with new context name

This commit is contained in:
Carsten Otto 2015-04-02 17:00:55 +02:00
parent 556c68c2e6
commit ae4ce272ff
4 changed files with 15 additions and 2 deletions

View file

@ -659,7 +659,7 @@ var ContextListPage = {
$.post(relative_to_root('contexts/'+context_id), {
'context[name]': value,
'_method': 'put'
}, highlight);
}, highlight, 'script');
return value;
},
setup_behavior: function() {

View file

@ -18,6 +18,7 @@ var <%=object_name%> = {
<% else -%>
<%=object_name%>.replace_context_form_with_updated_context();
<% end -%>
TracksForm.set_context_name("<%= escape_javascript(@context.name)%>");
},
remove_and_re_add_context: function() {
$('#<%=dom_id(@context, 'container')%>').slideUp(500, function() {

View file

@ -21,6 +21,13 @@ Feature: Edit a context
Then I should see that a context named "Errands" is not present
And I should see that a context named "OutAndAbout" is present
# Ticket #1796
@javascript
Scenario: I can change the name of the context and it should update the new todo form
When I go to the context page for "@pc"
And I edit the context name in place to be "OutAndAbout"
Then the context field of the new todo form should contain "OutAndAbout"
@javascript
Scenario: Editing the context of a todo will remove the todo
When I go to the the context page for "@pc"
@ -102,4 +109,4 @@ Feature: Edit a context
When I go to the "test" context
And I mark "deferred todo 1" as complete
Then I should see empty message for todos of context
And I should see empty message for deferred todos of context
And I should see empty message for deferred todos of context

View file

@ -119,6 +119,11 @@ Then /^the project field of the new todo form should contain "([^"]*)"$/ do |pro
expect(project_name).to eq(page.find(:xpath, xpath).value)
end
Then /^the context field of the new todo form should contain "([^"]*)"$/ do |context_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']"
expect(page.find(:xpath, xpath).value).to eq(context_name)
end
Then /^the default context of the new todo form should be "([^"]*)"$/ do |context_name|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']"
expect(context_name).to eq(page.find(:xpath, xpath).value)