mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
update form with new context name
This commit is contained in:
parent
556c68c2e6
commit
ae4ce272ff
4 changed files with 15 additions and 2 deletions
|
|
@ -659,7 +659,7 @@ var ContextListPage = {
|
||||||
$.post(relative_to_root('contexts/'+context_id), {
|
$.post(relative_to_root('contexts/'+context_id), {
|
||||||
'context[name]': value,
|
'context[name]': value,
|
||||||
'_method': 'put'
|
'_method': 'put'
|
||||||
}, highlight);
|
}, highlight, 'script');
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
setup_behavior: function() {
|
setup_behavior: function() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ var <%=object_name%> = {
|
||||||
<% else -%>
|
<% else -%>
|
||||||
<%=object_name%>.replace_context_form_with_updated_context();
|
<%=object_name%>.replace_context_form_with_updated_context();
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
TracksForm.set_context_name("<%= escape_javascript(@context.name)%>");
|
||||||
},
|
},
|
||||||
remove_and_re_add_context: function() {
|
remove_and_re_add_context: function() {
|
||||||
$('#<%=dom_id(@context, 'container')%>').slideUp(500, function() {
|
$('#<%=dom_id(@context, 'container')%>').slideUp(500, function() {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,13 @@ Feature: Edit a context
|
||||||
Then I should see that a context named "Errands" is not present
|
Then I should see that a context named "Errands" is not present
|
||||||
And I should see that a context named "OutAndAbout" is 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
|
@javascript
|
||||||
Scenario: Editing the context of a todo will remove the todo
|
Scenario: Editing the context of a todo will remove the todo
|
||||||
When I go to the the context page for "@pc"
|
When I go to the the context page for "@pc"
|
||||||
|
|
|
||||||
|
|
@ -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)
|
expect(project_name).to eq(page.find(:xpath, xpath).value)
|
||||||
end
|
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|
|
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']"
|
xpath= "//form[@id='todo-form-new-action']/input[@id='todo_context_name']"
|
||||||
expect(context_name).to eq(page.find(:xpath, xpath).value)
|
expect(context_name).to eq(page.find(:xpath, xpath).value)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue