summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-13 20:02:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-13 20:02:34 +0000
commit28e34e101cc3222c2eefb93201cf3cd957f81f7b (patch)
tree976a4bc0f94d0dbb544c49839db81a843fd11691 /test
parent327a6e54da602670d33b33b8054a9aa421e2f09d (diff)
downloadredmine-28e34e101cc3222c2eefb93201cf3cd957f81f7b.tar.gz
redmine-28e34e101cc3222c2eefb93201cf3cd957f81f7b.zip
Don't reload the page when adding/removing a block.
git-svn-id: http://svn.redmine.org/redmine/trunk@16394 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/functional/my_controller_test.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index e40dd91e3..76237dfb5 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -227,7 +227,7 @@ class MyControllerTest < Redmine::ControllerTest
xhr :post, :update_page, :settings => {'timelog' => {'days' => '14'}}
assert_response :success
- assert_include '$("#block-timelog").html(', response.body
+ assert_include '$("#block-timelog").replaceWith(', response.body
assert_include '14 days', response.body
assert_equal({:days => "14"}, user.reload.pref.my_page_settings('timelog'))
@@ -239,9 +239,15 @@ class MyControllerTest < Redmine::ControllerTest
assert User.find(2).pref[:my_page_layout]['top'].include?('issuesreportedbyme')
end
- def test_add_invalid_block_should_redirect
+ def test_add_block_xhr
+ xhr :post, :add_block, :block => 'issuesreportedbyme'
+ assert_response :success
+ assert_include 'issuesreportedbyme', User.find(2).pref[:my_page_layout]['top']
+ end
+
+ def test_add_invalid_block_should_error
post :add_block, :block => 'invalid'
- assert_redirected_to '/my/page'
+ assert_response 422
end
def test_remove_block
@@ -250,6 +256,13 @@ class MyControllerTest < Redmine::ControllerTest
assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
end
+ def test_remove_block_xhr
+ xhr :post, :remove_block, :block => 'issuesassignedtome'
+ assert_response :success
+ assert_include '$("#block-issuesassignedtome").remove();', response.body
+ assert !User.find(2).pref[:my_page_layout].values.flatten.include?('issuesassignedtome')
+ end
+
def test_order_blocks
xhr :post, :order_blocks, :group => 'left', 'blocks' => ['documents', 'calendar', 'latestnews']
assert_response :success