mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-19 08:40:12 +01:00
Add Selenium test for bug #776 and bug #775 and resolve both. Also fixed an unreported issue where deferring a todo by editing its show_from wouldn't hide an empty context.
This commit is contained in:
parent
0a39e1ea7e
commit
397029dfc1
4 changed files with 40 additions and 6 deletions
|
|
@ -221,7 +221,13 @@ class TodosController < ApplicationController
|
|||
@saved = @todo.update_attributes params["todo"]
|
||||
@context_changed = @original_item_context_id != @todo.context_id
|
||||
@todo_was_activated_from_deferred_state = @original_item_was_deferred && @todo.active?
|
||||
determine_remaining_in_context_count(@original_item_context_id) if @context_changed
|
||||
|
||||
if @context_changed
|
||||
determine_remaining_in_context_count(@original_item_context_id)
|
||||
else
|
||||
determine_remaining_in_context_count(@todo.context_id)
|
||||
end
|
||||
|
||||
@project_changed = @original_item_project_id != @todo.project_id
|
||||
if (@project_changed && !@original_item_project_id.nil?) then @remaining_undone_in_project = current_user.projects.find(@original_item_project_id).not_done_todo_count; end
|
||||
determine_down_count
|
||||
|
|
@ -391,6 +397,8 @@ class TodosController < ApplicationController
|
|||
@todo.show_from = (@todo.show_from || @todo.user.date) + numdays.days
|
||||
@saved = @todo.save
|
||||
|
||||
determine_down_count
|
||||
determine_remaining_in_context_count(@todo.context_id)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.js {render :action => 'update'}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,19 @@ if @saved
|
|||
|
||||
if (@remaining_in_context == 0)
|
||||
# remove context container from page if empty
|
||||
if @context_changed
|
||||
source_view do |from|
|
||||
from.todo { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
||||
from.tag { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
||||
from.context { page.show "c#{@original_item_context_id}empty-nd" }
|
||||
end
|
||||
else
|
||||
source_view do |from|
|
||||
from.todo { page.visual_effect :fade, item_container_id(@todo), :duration => 0.4 }
|
||||
from.tag { page.visual_effect :fade, item_container_id(@todo), :duration => 0.4 }
|
||||
from.context { page.show "c#{@original_item_context_id}empty-nd" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if source_view_is_one_of(:todo, :tag) && @todo.active?
|
||||
|
|
|
|||
10
test/selenium/home/defer_todo_empty_context.rsel
Normal file
10
test/selenium/home/defer_todo_empty_context.rsel
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
open "/"
|
||||
click "edit_icon_todo_5"
|
||||
wait_for_element_present "show_from_todo_5"
|
||||
type "show_from_todo_5", "1/1/2030"
|
||||
click "css=#submit_todo_5"
|
||||
wait_for_element_not_present "todo_5"
|
||||
assert_text 'badge_count', '9'
|
||||
wait_for_not_visible "c5"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
setup :fixtures => :all
|
||||
login :as => 'admin'
|
||||
open "/"
|
||||
wait_for_element_present '//div[@id="line_todo_5"]//img[@alt="Defer_1"]/..'
|
||||
click '//div[@id="line_todo_5"]//img[@alt="Defer_1"]/..'
|
||||
wait_for_element_not_present "todo_5"
|
||||
assert_text 'badge_count', '9'
|
||||
wait_for_not_visible "c5"
|
||||
Loading…
Add table
Add a link
Reference in a new issue