mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-01 23:08:49 +01:00
further fixing regressions
This commit is contained in:
parent
a8e426a2cd
commit
8b464112ad
7 changed files with 61 additions and 59 deletions
|
|
@ -794,9 +794,7 @@ var ProjectListPage = {
|
|||
var ContextListPage = {
|
||||
update_state_count: function(state, count) {
|
||||
$('#'+state+'-contexts-count').html(count);
|
||||
if (count==0) {
|
||||
ContextListPage.set_empty_message(state, true);
|
||||
}
|
||||
ContextListPage.set_empty_message(state, count==0);
|
||||
},
|
||||
update_all_states_count: function (active_count, hidden_count, closed_count) {
|
||||
$(["active", "hidden", "closed"]).each(function() {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
function update_container_states() {
|
||||
ContextListPage.update_all_states_count(<%=@active_contexts.count%>, <%=@hidden_contexts.count%>, <%=@closed_contexts.count%>);
|
||||
ContextListPage.show_or_hide_all_state_containers(<%= !@active_contexts.empty? %>, <%= !@hidden_contexts.empty? %>, <%= !@closed_contexts.empty? %>);
|
||||
}
|
||||
|
||||
function html_for_context_listing() {
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ Feature: Manage the list of contexts
|
|||
And I should see that the context container for closed contexts is present
|
||||
When I delete the context "@computer"
|
||||
Then I should see that a context named "@computer" is not present
|
||||
And I should see that the context container for active contexts is not present
|
||||
And I should see empty message for active contexts
|
||||
When I delete the context "@ipad"
|
||||
Then I should see that a context named "@ipad" is not present
|
||||
And I should see that the context container for hidden contexts is not present
|
||||
And I should see empty message for hidden contexts
|
||||
When I delete the context "@ibm-pc"
|
||||
Then I should see that a context named "@ibm-pc" is not present
|
||||
And I should see that the context container for closed contexts is not present
|
||||
And I should see empty message for closed contexts
|
||||
|
||||
@javascript
|
||||
Scenario: Delete context from context page right after an edit
|
||||
|
|
@ -137,5 +137,4 @@ Feature: Manage the list of contexts
|
|||
When I follow "Hide form"
|
||||
Then the new context form should not be visible
|
||||
When I follow "Create a new context"
|
||||
Then the new context form should be visible
|
||||
|
||||
Then the new context form should be visible
|
||||
|
|
@ -19,14 +19,20 @@ Feature: Edit a next action from every page
|
|||
When I go to the tag page for "starred"
|
||||
Then I should see "star me"
|
||||
|
||||
@javascript
|
||||
Scenario: I can delete a todo
|
||||
@javascript
|
||||
Scenario Outline: I can delete a todo
|
||||
Given I have a todo "delete me" in the context "@home"
|
||||
And I have selected the view for group by <grouping>
|
||||
When I go to the home page
|
||||
Then I should see "delete me"
|
||||
When I delete the action "delete me"
|
||||
Then I should not see "delete me"
|
||||
|
||||
Scenarios:
|
||||
| grouping |
|
||||
| context |
|
||||
| project |
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Removing the last todo in container will hide that container
|
||||
Given I have a todo "delete me" in the context "@home" in the project "do it!"
|
||||
|
|
@ -68,7 +74,6 @@ Feature: Edit a next action from every page
|
|||
| context | container for context "@home" | "@pc" | container for context "@pc" |
|
||||
| project | container for project "do it" | "go for it" | container for project "go for it" |
|
||||
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo
|
||||
Given I have a context called "@home"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
When /^I delete the context "([^\"]*)"$/ do |context_name|
|
||||
context = @current_user.contexts.where(:name => context_name).first
|
||||
context.should_not be_nil
|
||||
context = find_context(context_name)
|
||||
|
||||
handle_js_confirm do
|
||||
click_link "delete_context_#{context.id}"
|
||||
|
|
@ -14,75 +13,58 @@ end
|
|||
When /^I edit the context to rename it to "([^\"]*)"$/ do |new_name|
|
||||
find("a#link_edit_context_#{@context.id}").click
|
||||
|
||||
# wait for the form to appear (which included a submit button)
|
||||
page.should have_css("button#submit_context_#{@context.id}", :visible=>true)
|
||||
wait_for_context_form_to_appear(@context)
|
||||
|
||||
within "div.edit-form" do
|
||||
fill_in "context_name", :with => new_name
|
||||
click_button "submit_context_#{@context.id}"
|
||||
end
|
||||
|
||||
# wait for the form to go away
|
||||
page.should_not have_css("button#submit_context_#{@context.id}", :visible => true)
|
||||
# wait for the changed context to appear
|
||||
page.should have_css("a#link_edit_context_#{@context.id}", :visible=> true)
|
||||
wait_for_context_form_to_go_away(@context)
|
||||
end
|
||||
|
||||
When /^I add a new context "([^"]*)"$/ do |context_name|
|
||||
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 active context "([^"]*)"$/ do |context_name|
|
||||
When(/^I add a new active context "([^"]*)"$/) do |context_name|
|
||||
step "I add a new context \"#{context_name}\""
|
||||
end
|
||||
|
||||
When /^I add a new hidden context "([^"]*)"$/ do |context_name|
|
||||
When(/^I add a new hidden context "([^"]*)"$/) do |context_name|
|
||||
fill_in "context[name]", :with => context_name
|
||||
check "context_state_hide"
|
||||
submit_new_context_form
|
||||
end
|
||||
|
||||
When /^I drag context "([^"]*)" above context "([^"]*)"$/ do |context_drag, context_drop|
|
||||
drag_id = @current_user.contexts.where(:name => context_drag).first.id
|
||||
sortable_css = "div.ui-sortable div#container_context_#{drag_id}"
|
||||
When(/^I drag context "([^"]*)" above context "([^"]*)"$/) do |context_drag, context_drop|
|
||||
drag_id = find_context(context_drag).id
|
||||
|
||||
drag_index = context_list_find_index(context_drag)
|
||||
drop_index = context_list_find_index(context_drop)
|
||||
|
||||
page.execute_script "$('#{sortable_css}').simulateDragSortable({move: #{drop_index-drag_index}, handle: '.grip'});"
|
||||
context_drag_and_drop(drag_id, drop_index-drag_index)
|
||||
end
|
||||
|
||||
When /^I edit the state of context "(.*?)" to closed$/ do |context_name|
|
||||
context = @current_user.contexts.where(:name => context_name).first
|
||||
context.should_not be_nil
|
||||
|
||||
# open edit form
|
||||
page.find("a#link_edit_context_#{context.id}").click
|
||||
|
||||
# wait for the form to appear (which included a submit button)
|
||||
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
context = find_context(context_name)
|
||||
|
||||
open_context_edit_form(context)
|
||||
# change state
|
||||
within "form#edit_form_context_#{context.id}" do
|
||||
find("input#context_state_closed").click
|
||||
click_button "submit_context_#{context.id}"
|
||||
end
|
||||
|
||||
# wait for the form to go away
|
||||
page.should_not have_css("button#submit_context_#{context.id}", :visible => true)
|
||||
# wait for the changed context to appear
|
||||
elem = page.find("a#link_edit_context_#{context.id}")
|
||||
elem.should_not be_nil
|
||||
|
||||
page.should have_css("a#link_edit_context_#{context.id}", :visible=> true)
|
||||
wait_for_context_form_to_go_away(context)
|
||||
end
|
||||
|
||||
Then /^context "([^"]*)" should be above context "([^"]*)"$/ do |context_high, context_low|
|
||||
context_list_find_index(context_high).should < context_list_find_index(context_low)
|
||||
end
|
||||
|
||||
Then /^I should see that a context named "([^"]*)" (is|is not) present$/ do |context_name, present|
|
||||
Then(/^I should see that a context named "([^"]*)" (is|is not) present$/) do |context_name, present|
|
||||
is_not = present=="is not" ? "not " : ""
|
||||
within "div#display_box" do
|
||||
step "I should #{is_not}see \"#{context_name}\""
|
||||
|
|
@ -90,18 +72,18 @@ Then /^I should see that a context named "([^"]*)" (is|is not) present$/ do |con
|
|||
end
|
||||
|
||||
Then /^I should see that the context container for (.*) contexts (is|is not) present$/ do |state, visible|
|
||||
page.send(visible=="is" ? :should : :should_not, have_css("div#list-#{state}-contexts-container", :visible => true))
|
||||
v = {"is" => "see", "is not" => "not see"}[visible] # map is|is not to see|not see
|
||||
check_css_visibility(v, "div#list-#{state}-contexts-container" )
|
||||
end
|
||||
|
||||
Then /^I should see the context "([^"]*)" under "([^"]*)"$/ do |context_name, state|
|
||||
context = Context.where(:name => context_name).first
|
||||
context.should_not be_nil
|
||||
|
||||
page.has_css?("div#list-contexts-#{state} div#context_#{context.id}").should be_true
|
||||
context = find_context(context_name)
|
||||
check_css_visibility("see", "div#list-contexts-#{state} div#context_#{context.id}")
|
||||
end
|
||||
|
||||
Then /^the new context form should (be|not be) visible$/ do |visible|
|
||||
page.has_css?("div#context_new", :visible => true).should (visible=="be" ? be_true : be_false)
|
||||
v = {"be" => "see", "not be" => "not see"}[visible] # map be|not be to see|not see
|
||||
check_css_visibility(v, "div#context_new")
|
||||
end
|
||||
|
||||
Then /^the context list badge for ([^"]*) contexts should show (\d+)$/ do |state_name, count|
|
||||
|
|
@ -109,10 +91,5 @@ Then /^the context list badge for ([^"]*) contexts should show (\d+)$/ do |state
|
|||
end
|
||||
|
||||
Then /^I should (see|not see) empty message for (active|hidden|closed) contexts$/ do |visible, state|
|
||||
box = "div##{state}-contexts-empty-nd"
|
||||
|
||||
elem = page.find(box)
|
||||
elem.should_not be_nil
|
||||
|
||||
elem.send(visible=="see" ? "should" : "should_not", be_visible)
|
||||
check_css_visibility(visible, "div##{state}-contexts-empty-nd")
|
||||
end
|
||||
|
|
@ -12,6 +12,14 @@ module TracksFormHelper
|
|||
wait_for_animations_to_end
|
||||
end
|
||||
|
||||
def open_context_edit_form(context)
|
||||
# open edit form
|
||||
page.find("a#link_edit_context_#{context.id}").click
|
||||
|
||||
# wait for the form to appear (which included a submit button)
|
||||
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
end
|
||||
|
||||
def submit_form(form_xpath, button_name)
|
||||
handle_js_confirm do
|
||||
# on calendar page there can be more than 1 occurance of a todo, so we select the first here
|
||||
|
|
@ -47,6 +55,17 @@ module TracksFormHelper
|
|||
def wait_for_todo_form_to_go_away(todo)
|
||||
page.should_not have_content("button#submit_todo_#{todo.id}")
|
||||
end
|
||||
|
||||
def wait_for_context_form_to_appear(context)
|
||||
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
end
|
||||
|
||||
def wait_for_context_form_to_go_away(context)
|
||||
# wait for the form to go away
|
||||
page.should_not have_css("button#submit_context_#{context.id}", :visible => true)
|
||||
# wait for the changed context to appear
|
||||
page.should have_css("a#link_edit_context_#{context.id}", :visible=> true)
|
||||
end
|
||||
|
||||
def open_project_edit_form(project)
|
||||
click_link "link_edit_project_#{project.id}"
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ module TracksStepHelper
|
|||
page.execute_script(js)
|
||||
end
|
||||
|
||||
def context_drag_and_drop(drag_id, delta)
|
||||
sortable_css = "div.ui-sortable div#container_context_#{drag_id}"
|
||||
execute_javascript("$('#{sortable_css}').simulateDragSortable({move: #{delta}, handle: '.grip'});")
|
||||
end
|
||||
|
||||
def open_submenu_for(todo)
|
||||
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
||||
page.should have_css(submenu_arrow, :visible=>true)
|
||||
|
|
@ -109,12 +114,12 @@ module TracksStepHelper
|
|||
end
|
||||
|
||||
def handle_js_confirm(accept=true)
|
||||
page.execute_script "window.original_confirm_function = window.confirm"
|
||||
page.execute_script "window.confirmMsg = null"
|
||||
page.execute_script "window.confirm = function(msg) { window.confirmMsg = msg; return #{!!accept}; }"
|
||||
execute_javascript "window.original_confirm_function = window.confirm"
|
||||
execute_javascript "window.confirmMsg = null"
|
||||
execute_javascript "window.confirm = function(msg) { window.confirmMsg = msg; return #{!!accept}; }"
|
||||
yield
|
||||
ensure
|
||||
page.execute_script "window.confirm = window.original_confirm_function"
|
||||
execute_javascript "window.confirm = window.original_confirm_function"
|
||||
end
|
||||
|
||||
def get_confirm_text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue