From 28e34e101cc3222c2eefb93201cf3cd957f81f7b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 13 Mar 2017 20:02:34 +0000 Subject: 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 --- test/functional/my_controller_test.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3