Warning on leaving a page with unsaved content in textarea (#2910).
The warning can be turned off in the user's preference. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4900 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -67,4 +67,28 @@ class WelcomeControllerTest < ActionController::TestCase
|
||||
assert_equal 'text/plain', @response.content_type
|
||||
assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$})
|
||||
end
|
||||
|
||||
def test_warn_on_leaving_unsaved_turn_on
|
||||
user = User.find(2)
|
||||
user.pref.warn_on_leaving_unsaved = '1'
|
||||
user.pref.save!
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :index
|
||||
assert_tag 'script',
|
||||
:attributes => {:type => "text/javascript"},
|
||||
:content => %r{new WarnLeavingUnsaved}
|
||||
end
|
||||
|
||||
def test_warn_on_leaving_unsaved_turn_off
|
||||
user = User.find(2)
|
||||
user.pref.warn_on_leaving_unsaved = '0'
|
||||
user.pref.save!
|
||||
@request.session[:user_id] = 2
|
||||
|
||||
get :index
|
||||
assert_no_tag 'script',
|
||||
:attributes => {:type => "text/javascript"},
|
||||
:content => %r{new WarnLeavingUnsaved}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user