From 9ddd5c5d2aae8cffcbde76fb68135ccbcf285226 Mon Sep 17 00:00:00 2001 From: Eric Allen Date: Sun, 20 Dec 2009 13:05:42 -0500 Subject: [PATCH] Correct context hiding behavior in tag view Fixes #952 --- app/views/todos/create.js.rjs | 2 +- app/views/todos/toggle_check.js.rjs | 2 +- test/selenium/tags/complete_last_todo.rsel | 7 +++++++ test/selenium/tags/create_todo_in_hidden_context.rsel | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 test/selenium/tags/complete_last_todo.rsel create mode 100644 test/selenium/tags/create_todo_in_hidden_context.rsel diff --git a/app/views/todos/create.js.rjs b/app/views/todos/create.js.rjs index 77a3be5a..597ba418 100644 --- a/app/views/todos/create.js.rjs +++ b/app/views/todos/create.js.rjs @@ -17,7 +17,7 @@ if @saved if @new_context_created page.insert_html :top, 'display_box', :partial => 'contexts/context', :locals => { :context => @todo.context, :collapsible => true } else - page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" if source_view_is_one_of(:todo, :deferred) + page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" if source_view_is_one_of(:todo, :deferred, :tag) page.insert_html :bottom, item_container_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type, :source_view => @source_view } page.visual_effect :highlight, dom_id(@todo), :duration => 3 page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? diff --git a/app/views/todos/toggle_check.js.rjs b/app/views/todos/toggle_check.js.rjs index bd2ff2b6..b1e24e29 100644 --- a/app/views/todos/toggle_check.js.rjs +++ b/app/views/todos/toggle_check.js.rjs @@ -20,7 +20,7 @@ if @saved end # remove container if empty - if @remaining_in_context == 0 && source_view_is(:todo) + if @remaining_in_context == 0 && source_view_is_one_of(:todo, :tag) page.visual_effect :fade, "c"+@todo.context.id.to_s, :duration => 0.4 end diff --git a/test/selenium/tags/complete_last_todo.rsel b/test/selenium/tags/complete_last_todo.rsel new file mode 100644 index 00000000..ee3be43f --- /dev/null +++ b/test/selenium/tags/complete_last_todo.rsel @@ -0,0 +1,7 @@ +#Test for issue #952 +setup :fixtures => :all +login :as => 'admin' +open "/todos/tag/foo" +click "css=#line_todo_2 .item-checkbox" +wait_for_element_not_present "css=#c2 #line_todo_2" +wait_for_not_visible "c2" diff --git a/test/selenium/tags/create_todo_in_hidden_context.rsel b/test/selenium/tags/create_todo_in_hidden_context.rsel new file mode 100644 index 00000000..7ea8d481 --- /dev/null +++ b/test/selenium/tags/create_todo_in_hidden_context.rsel @@ -0,0 +1,8 @@ +setup :fixtures => :all +login :as => 'admin' +open "/todos/tag/foo" +type "todo_description", "run around" +type "todo_context_name", "freetime" +click "todo_new_action_submit" +wait_for_visible "flash" +assert_text "css=#c7items div.description span", "run around"