mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Ability to render multiple partials with view hook (#17763).
git-svn-id: http://svn.redmine.org/redmine/trunk@13449 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -45,6 +45,14 @@ class HookTest < ActionController::IntegrationTest
|
||||
VIEW
|
||||
end
|
||||
|
||||
class SingleRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_welcome_index_left, :inline => 'SingleRenderOn 1'
|
||||
end
|
||||
|
||||
class MultipleRenderOn < Redmine::Hook::ViewListener
|
||||
render_on :view_welcome_index_left, {:inline => 'MultipleRenderOn 1'}, {:inline => 'MultipleRenderOn 2'}
|
||||
end
|
||||
|
||||
# Hooks that stores the call context
|
||||
class ContextTestHook < Redmine::Hook::ViewListener
|
||||
cattr_accessor :context
|
||||
@@ -105,4 +113,11 @@ VIEW
|
||||
assert_kind_of Hash, context[:request].params
|
||||
assert_kind_of AccountController, context[:hook_caller]
|
||||
end
|
||||
|
||||
def test_multiple_hooks
|
||||
Redmine::Hook.add_listener(SingleRenderOn)
|
||||
Redmine::Hook.add_listener(MultipleRenderOn)
|
||||
get '/'
|
||||
assert_equal 1, response.body.scan("SingleRenderOn 1 MultipleRenderOn 1 MultipleRenderOn 2").size
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user