Patch #44660 » 07_admin_list_hooks.patch
| app/views/admin/plugins.html.erb | ||
|---|---|---|
|
<%= title l(:label_plugins) %>
|
||
|
<%= call_hook(:view_admin_plugins_top, :plugins => @plugins) %>
|
||
|
<% if @plugins.any? %>
|
||
|
<div class="autoscroll">
|
||
| ... | ... | |
|
<th><%= l(:field_name) %> / <%= l(:field_description) %></th>
|
||
|
<th><%= l(:field_author) %></th>
|
||
|
<th><%= l(:label_version) %></th>
|
||
|
<%= call_hook(:view_admin_plugins_table_header) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
</td>
|
||
|
<td class="author"><%= plugin.author_url.blank? ? plugin.author : link_to(plugin.author, plugin.author_url) %></td>
|
||
|
<td class="version"><span class="icon"><%= plugin.version %></span></td>
|
||
|
<%= call_hook(:view_admin_plugins_table_row, :plugin => plugin) %>
|
||
|
<td class="configure"><%= link_to(l(:button_configure), plugin_settings_path(plugin)) if plugin.configurable? %></td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
| app/views/custom_fields/_index.html.erb | ||
|---|---|---|
|
<th><%=l(:field_is_for_all)%></th>
|
||
|
<th><%=l(:label_used_by)%></th>
|
||
|
<% end %>
|
||
|
<%= call_hook(:view_custom_fields_index_table_header, :custom_field_type => tab[:name]) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
<td><%= checked_image custom_field.is_for_all? %></td>
|
||
|
<td><%= l(:label_x_projects, :count => @custom_fields_projects_count[custom_field.id] || 0) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
||
|
<% end %>
|
||
|
<%= call_hook(:view_custom_fields_index_table_row, :custom_field => custom_field) %>
|
||
|
<td class="buttons">
|
||
|
<%= reorder_handle(custom_field, :url => custom_field_path(custom_field), :param => 'custom_field') %>
|
||
|
<%= link_to_function sprite_icon('copy', l(:button_copy)), "location.href = '#{new_custom_field_path(:copy => custom_field)}&type=' + encodeURIComponent(($('.tabs a.selected').attr('id')||'').split('tab-').pop())", :class => 'icon icon-copy' %>
|
||
| app/views/enumerations/_form.html.erb | ||
|---|---|---|
|
<%= error_messages_for 'enumeration' %>
|
||
|
<div class="box tabular">
|
||
|
<%= call_hook(:view_enumerations_form_top, :enumeration => @enumeration, :form => f) %>
|
||
|
<p><%= f.text_field :name %></p>
|
||
|
<p><%= f.check_box :active %></p>
|
||
|
<p><%= f.check_box :is_default %></p>
|
||
| ... | ... | |
|
<% @enumeration.custom_field_values.each do |value| %>
|
||
|
<p><%= custom_field_tag_with_label :enumeration, value %></p>
|
||
|
<% end %>
|
||
|
<%= call_hook(:view_enumerations_form_bottom, :enumeration => @enumeration, :form => f) %>
|
||
|
</div>
|
||
| app/views/enumerations/index.html.erb | ||
|---|---|---|
|
<th><%= l(:field_name) %></th>
|
||
|
<th><%= l(:field_is_default) %></th>
|
||
|
<th><%= l(:field_active) %></th>
|
||
|
<%= call_hook(:view_enumerations_index_table_header, :enumeration_class => klass) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<% enumerations.each do |enumeration| %>
|
||
| ... | ... | |
|
<td class="name"><%= link_to enumeration, edit_enumeration_path(enumeration) %></td>
|
||
|
<td class="tick"><%= checked_image enumeration.is_default? %></td>
|
||
|
<td class="tick"><%= checked_image enumeration.active? %></td>
|
||
|
<%= call_hook(:view_enumerations_index_table_row, :enumeration => enumeration) %>
|
||
|
<td class="buttons">
|
||
|
<%= reorder_handle(enumeration, :url => enumeration_path(enumeration), :param => 'enumeration') %>
|
||
|
<%= delete_link enumeration_path(enumeration) %>
|
||
| app/views/groups/index.html.erb | ||
|---|---|---|
|
<thead><tr>
|
||
|
<th><%=l(:label_group)%></th>
|
||
|
<th><%=l(:label_user_plural)%></th>
|
||
|
<%= call_hook(:view_groups_index_table_header) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
<tr id="group-<%= group.id %>" class="<%= "builtin" if group.builtin? %>">
|
||
|
<td class="name"><%= link_to group, edit_group_path(group) %></td>
|
||
|
<td class="user_count"><%= (@user_count_by_group_id[group.id] || 0) unless group.builtin? %></td>
|
||
|
<%= call_hook(:view_groups_index_table_row, :group => group) %>
|
||
|
<td class="buttons"><%= delete_link group unless group.builtin? %></td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
| app/views/issue_statuses/_form.html.erb | ||
|---|---|---|
|
<%= error_messages_for 'issue_status' %>
|
||
|
<div class="box tabular">
|
||
|
<%= call_hook(:view_issue_statuses_form_top, :issue_status => @issue_status, :form => f) %>
|
||
|
<p><%= f.text_field :name, :required => true %></p>
|
||
|
<p><%= f.textarea :description, :rows => 4 %></p>
|
||
|
<% if Issue.use_status_for_done_ratio? %>
|
||
| ... | ... | |
|
<p><%= f.check_box :is_closed %></p>
|
||
|
<%= call_hook(:view_issue_statuses_form, :issue_status => @issue_status) %>
|
||
|
<%= call_hook(:view_issue_statuses_form_bottom, :issue_status => @issue_status, :form => f) %>
|
||
|
</div>
|
||
| app/views/issue_statuses/index.html.erb | ||
|---|---|---|
|
<th><%=l(:field_is_closed)%></th>
|
||
|
<th><%=l(:field_description)%></th>
|
||
|
<th></th>
|
||
|
<%= call_hook(:view_issue_statuses_index_table_header) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
</span>
|
||
|
<% end %>
|
||
|
</td>
|
||
|
<%= call_hook(:view_issue_statuses_index_table_row, :issue_status => status) %>
|
||
|
<td class="buttons">
|
||
|
<%= reorder_handle(status) %>
|
||
|
<%= delete_link issue_status_path(status) %>
|
||
| app/views/roles/_form.html.erb | ||
|---|---|---|
|
<%= error_messages_for 'role' %>
|
||
|
<div class="box tabular">
|
||
|
<%= call_hook(:view_roles_form_top, :role => @role, :form => f) %>
|
||
|
<% unless @role.builtin? %>
|
||
|
<p><%= f.text_field :name, :required => true %></p>
|
||
|
<p><%= f.check_box :assignable %></p>
|
||
| ... | ... | |
|
<p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
|
||
|
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
|
||
|
<% end %>
|
||
|
<%= call_hook(:view_roles_form_bottom, :role => @role, :form => f) %>
|
||
|
</div>
|
||
|
<h3><%= l(:label_permissions) %></h3>
|
||
| app/views/roles/index.html.erb | ||
|---|---|---|
|
<thead><tr>
|
||
|
<th><%=l(:label_role)%></th>
|
||
|
<th></th>
|
||
|
<%= call_hook(:view_roles_index_table_header) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
</span>
|
||
|
<% end %>
|
||
|
</td>
|
||
|
<%= call_hook(:view_roles_index_table_row, :role => role) %>
|
||
|
<td class="buttons">
|
||
|
<%= reorder_handle(role) unless role.builtin? %>
|
||
|
<%= link_to sprite_icon('copy', l(:button_copy)), new_role_path(:copy => role), :class => 'icon icon-copy' %>
|
||
| app/views/trackers/index.html.erb | ||
|---|---|---|
|
<th><%=l(:field_default_status)%></th>
|
||
|
<th><%=l(:field_description)%></th>
|
||
|
<th></th>
|
||
|
<%= call_hook(:view_trackers_index_table_header) %>
|
||
|
<th></th>
|
||
|
</tr></thead>
|
||
|
<tbody>
|
||
| ... | ... | |
|
</span>
|
||
|
<% end %>
|
||
|
</td>
|
||
|
<%= call_hook(:view_trackers_index_table_row, :tracker => tracker) %>
|
||
|
<td class="buttons">
|
||
|
<%= reorder_handle(tracker) %>
|
||
|
<%= link_to sprite_icon('copy', l(:button_copy)), new_tracker_path(:copy => tracker), :class => 'icon icon-copy' %>
|
||
| doc/HOOKS | ||
|---|---|---|
|
Context: :user
|
||
|
Called in: app/views/users/show.html.erb
|
||
|
view_admin_plugins_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: -
|
||
|
Called in: app/views/admin/plugins.html.erb
|
||
|
view_admin_plugins_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :plugin
|
||
|
Called in: app/views/admin/plugins.html.erb
|
||
|
view_admin_plugins_top
|
||
|
Since: 7.1.0
|
||
|
Context: :plugins
|
||
|
Called in: app/views/admin/plugins.html.erb
|
||
|
view_admin_projects_sidebar_queries_bottom
|
||
|
Since: -
|
||
|
Context: -
|
||
| ... | ... | |
|
Context: :custom_field, :form
|
||
|
Called in: app/views/custom_fields/_form.html.erb
|
||
|
view_custom_fields_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: :custom_field_type
|
||
|
Called in: app/views/custom_fields/_index.html.erb
|
||
|
view_custom_fields_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :custom_field
|
||
|
Called in: app/views/custom_fields/_index.html.erb
|
||
|
view_documents_index_contextual
|
||
|
Since: 7.1.0
|
||
|
Context: :project
|
||
| ... | ... | |
|
Context: :document, :project
|
||
|
Called in: app/views/documents/show.html.erb
|
||
|
view_enumerations_form_bottom
|
||
|
Since: 7.1.0
|
||
|
Context: :enumeration, :form
|
||
|
Called in: app/views/enumerations/_form.html.erb
|
||
|
view_enumerations_form_top
|
||
|
Since: 7.1.0
|
||
|
Context: :enumeration, :form
|
||
|
Called in: app/views/enumerations/_form.html.erb
|
||
|
view_enumerations_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: :enumeration_class
|
||
|
Called in: app/views/enumerations/index.html.erb
|
||
|
view_enumerations_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :enumeration
|
||
|
Called in: app/views/enumerations/index.html.erb
|
||
|
view_groups_form_bottom
|
||
|
Since: 7.1.0
|
||
|
Context: :group, :form
|
||
| ... | ... | |
|
Context: :group, :form
|
||
|
Called in: app/views/groups/_form.html.erb
|
||
|
view_groups_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: -
|
||
|
Called in: app/views/groups/index.html.erb
|
||
|
view_groups_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :group
|
||
|
Called in: app/views/groups/index.html.erb
|
||
|
view_groups_memberships_table_header
|
||
|
Since: -
|
||
|
Context: :group
|
||
| ... | ... | |
|
Context: :issue_status
|
||
|
Called in: app/views/issue_statuses/_form.html.erb
|
||
|
view_issue_statuses_form_bottom
|
||
|
Since: 7.1.0
|
||
|
Context: :issue_status, :form
|
||
|
Called in: app/views/issue_statuses/_form.html.erb
|
||
|
view_issue_statuses_form_top
|
||
|
Since: 7.1.0
|
||
|
Context: :issue_status, :form
|
||
|
Called in: app/views/issue_statuses/_form.html.erb
|
||
|
view_issue_statuses_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: -
|
||
|
Called in: app/views/issue_statuses/index.html.erb
|
||
|
view_issue_statuses_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :issue_status
|
||
|
Called in: app/views/issue_statuses/index.html.erb
|
||
|
view_issues_bulk_edit_details_bottom
|
||
|
Since: -
|
||
|
Context: :issues
|
||
| ... | ... | |
|
Called in: app/views/repositories/entry.html.erb
|
||
|
Called in: app/views/repositories/show.html.erb
|
||
|
view_roles_form_bottom
|
||
|
Since: 7.1.0
|
||
|
Context: :role, :form
|
||
|
Called in: app/views/roles/_form.html.erb
|
||
|
view_roles_form_top
|
||
|
Since: 7.1.0
|
||
|
Context: :role, :form
|
||
|
Called in: app/views/roles/_form.html.erb
|
||
|
view_roles_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: -
|
||
|
Called in: app/views/roles/index.html.erb
|
||
|
view_roles_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :role
|
||
|
Called in: app/views/roles/index.html.erb
|
||
|
view_search_index_options_content_bottom
|
||
|
Since: -
|
||
|
Context: -
|
||
| ... | ... | |
|
Context: :tracker, :form
|
||
|
Called in: app/views/trackers/_form.html.erb
|
||
|
view_trackers_index_table_header
|
||
|
Since: 7.1.0
|
||
|
Context: -
|
||
|
Called in: app/views/trackers/index.html.erb
|
||
|
view_trackers_index_table_row
|
||
|
Since: 7.1.0
|
||
|
Context: :tracker
|
||
|
Called in: app/views/trackers/index.html.erb
|
||
|
view_users_form
|
||
|
Since: -
|
||
|
Context: :user, :form
|
||
| test/integration/lib/redmine/admin_list_hooks_test.rb | ||
|---|---|---|
|
# frozen_string_literal: true
|
||
|
# Redmine - project management software
|
||
|
# Copyright (C) 2006- Jean-Philippe Lang
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or
|
||
|
# modify it under the terms of the GNU General Public License
|
||
|
# as published by the Free Software Foundation; either version 2
|
||
|
# of the License, or (at your option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful,
|
||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
# GNU General Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License
|
||
|
# along with this program; if not, write to the Free Software
|
||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
require_relative '../../../test_helper'
|
||
|
# The hooks that let plugins add columns to the administration's lists and to
|
||
|
# the plugin list, and fields to the forms of statuses, roles and enumerations:
|
||
|
# each one is called on its page, the added cells come before the buttons and
|
||
|
# match the added headers, and what a plugin adds leaves the page's HTML as
|
||
|
# valid as it was.
|
||
|
class AdminListHooksTest < Redmine::IntegrationTest
|
||
|
# The list pages, the table on each one, its header and row hooks and the
|
||
|
# class of the last cell of a row (buttons by default)
|
||
|
LISTS = {
|
||
|
'/trackers' => ['table.list.trackers', 'view_trackers_index_table'],
|
||
|
'/issue_statuses' => ['table.list.issue_statuses', 'view_issue_statuses_index_table'],
|
||
|
'/roles' => ['table.list.roles', 'view_roles_index_table'],
|
||
|
'/enumerations' => ['table.list.enumerations', 'view_enumerations_index_table'],
|
||
|
'/groups' => ['table.list.groups', 'view_groups_index_table'],
|
||
|
'/custom_fields' => ['table.list.custom_fields', 'view_custom_fields_index_table'],
|
||
|
'/admin/plugins' => ['table.list.plugins', 'view_admin_plugins_table', 'configure']
|
||
|
}
|
||
|
# The forms and their top and bottom hooks
|
||
|
FORMS = {
|
||
|
'/issue_statuses/1/edit' => 'view_issue_statuses_form',
|
||
|
'/issue_statuses/new' => 'view_issue_statuses_form',
|
||
|
'/roles/1/edit' => 'view_roles_form',
|
||
|
'/roles/new' => 'view_roles_form',
|
||
|
'/enumerations/new?type=IssuePriority' => 'view_enumerations_form'
|
||
|
}
|
||
|
# Answers every hook with a marker that is valid where the hook is called,
|
||
|
# and remembers the context it was given
|
||
|
class MarkerListener < Redmine::Hook::ViewListener
|
||
|
cattr_accessor :contexts
|
||
|
self.contexts = Hash.new {|h, k| h[k] = []}
|
||
|
LISTS.each_value do |_table, prefix, _last|
|
||
|
define_method(:"#{prefix}_header") do |context|
|
||
|
contexts["#{prefix}_header"] << context
|
||
|
content_tag('th', 'marker', :class => "hook-#{prefix}_header")
|
||
|
end
|
||
|
define_method(:"#{prefix}_row") do |context|
|
||
|
contexts["#{prefix}_row"] << context
|
||
|
content_tag('td', 'marker', :class => "hook-#{prefix}_row")
|
||
|
end
|
||
|
end
|
||
|
FORMS.each_value.uniq.each do |prefix|
|
||
|
%w(top bottom).each do |place|
|
||
|
define_method(:"#{prefix}_#{place}") do |context|
|
||
|
contexts["#{prefix}_#{place}"] << context
|
||
|
content_tag('p', 'marker', :class => "hook-#{prefix}_#{place}")
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
define_method(:view_admin_plugins_top) do |context|
|
||
|
contexts['view_admin_plugins_top'] << context
|
||
|
content_tag('div', 'marker', :class => 'hook-view_admin_plugins_top')
|
||
|
end
|
||
|
end
|
||
|
def setup
|
||
|
Redmine::Hook.clear_listeners
|
||
|
MarkerListener.contexts.clear
|
||
|
# The plugin list has a table only when a plugin is registered
|
||
|
Redmine::Plugin.register :admin_list_hooks_test_plugin do
|
||
|
name 'Test plugin'
|
||
|
directory 'test/fixtures/plugins/foo_plugin'
|
||
|
end
|
||
|
log_user('admin', 'admin')
|
||
|
end
|
||
|
def teardown
|
||
|
Redmine::Hook.clear_listeners
|
||
|
Redmine::Plugin.unregister(:admin_list_hooks_test_plugin)
|
||
|
end
|
||
|
def html_errors
|
||
|
Nokogiri::HTML5(response.body, :max_errors => 100).errors.map(&:to_s)
|
||
|
end
|
||
|
def test_list_hooks_should_add_a_header_and_a_cell_before_the_buttons
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
LISTS.each do |path, (table, prefix, last)|
|
||
|
get path
|
||
|
assert_response :success, path
|
||
|
assert_select "#{table} thead th.hook-#{prefix}_header", {:minimum => 1}, "#{prefix}_header not called on #{path}"
|
||
|
assert_select "#{table} thead th.hook-#{prefix}_header + th:last-child", {:minimum => 1},
|
||
|
"#{prefix}_header not before the buttons' column on #{path}"
|
||
|
assert_select "#{table} td.hook-#{prefix}_row + td.#{last || 'buttons'}", {:minimum => 1},
|
||
|
"#{prefix}_row not before the buttons on #{path}"
|
||
|
end
|
||
|
end
|
||
|
def test_every_row_should_have_as_many_cells_as_the_header
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
LISTS.each do |path, (table, _prefix)|
|
||
|
get path
|
||
|
css_select(table).each do |t|
|
||
|
headers = t.css('thead th').size
|
||
|
t.css('tr').reject {|tr| tr.ancestors('thead').any?}.each do |tr|
|
||
|
assert_equal headers, tr.css('td').size, "A row of #{table} on #{path} has another number of cells than its header"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_list_hooks_should_get_the_object_of_their_row
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
get '/trackers'
|
||
|
assert_equal Tracker.sorted.to_a, MarkerListener.contexts['view_trackers_index_table_row'].pluck(:tracker)
|
||
|
get '/issue_statuses'
|
||
|
assert_equal IssueStatus.sorted.to_a, MarkerListener.contexts['view_issue_statuses_index_table_row'].pluck(:issue_status)
|
||
|
get '/roles'
|
||
|
assert_equal Role.sorted.to_a, MarkerListener.contexts['view_roles_index_table_row'].pluck(:role)
|
||
|
get '/enumerations'
|
||
|
assert_includes MarkerListener.contexts['view_enumerations_index_table_header'].pluck(:enumeration_class), IssuePriority
|
||
|
assert_includes MarkerListener.contexts['view_enumerations_index_table_row'].pluck(:enumeration), IssuePriority.shared.first
|
||
|
get '/groups'
|
||
|
assert_includes MarkerListener.contexts['view_groups_index_table_row'].pluck(:group), Group.find(10)
|
||
|
get '/custom_fields'
|
||
|
assert_includes MarkerListener.contexts['view_custom_fields_index_table_header'].pluck(:custom_field_type), 'IssueCustomField'
|
||
|
assert_includes MarkerListener.contexts['view_custom_fields_index_table_row'].pluck(:custom_field), CustomField.find(1)
|
||
|
get '/admin/plugins'
|
||
|
assert_includes MarkerListener.contexts['view_admin_plugins_table_row'].pluck(:plugin),
|
||
|
Redmine::Plugin.find(:admin_list_hooks_test_plugin)
|
||
|
end
|
||
|
def test_plugins_top_hook_should_be_under_the_title
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
get '/admin/plugins'
|
||
|
assert_select 'h2 + div.hook-view_admin_plugins_top + div.autoscroll table.list.plugins'
|
||
|
assert_includes MarkerListener.contexts['view_admin_plugins_top'].last[:plugins],
|
||
|
Redmine::Plugin.find(:admin_list_hooks_test_plugin)
|
||
|
end
|
||
|
def test_form_hooks_should_be_first_and_last_in_the_box
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
FORMS.each do |path, prefix|
|
||
|
get path
|
||
|
assert_response :success, path
|
||
|
assert_select "div.box.tabular > p.hook-#{prefix}_top:first-child", {:count => 1}, "#{prefix}_top not first on #{path}"
|
||
|
assert_select "div.box.tabular > p.hook-#{prefix}_bottom:last-child", {:count => 1}, "#{prefix}_bottom not last on #{path}"
|
||
|
assert MarkerListener.contexts["#{prefix}_top"].last[:form], "#{prefix}_top has no form on #{path}"
|
||
|
end
|
||
|
end
|
||
|
def test_the_existing_issue_status_form_hook_should_still_be_called
|
||
|
listener = Class.new(Redmine::Hook::ViewListener) do
|
||
|
define_method(:view_issue_statuses_form) {|context| content_tag('p', context[:issue_status].name, :class => 'old-hook')}
|
||
|
end
|
||
|
Redmine::Hook.add_listener(listener)
|
||
|
get '/issue_statuses/1/edit'
|
||
|
assert_select 'p.old-hook', :text => IssueStatus.find(1).name
|
||
|
end
|
||
|
def test_hook_output_should_not_make_the_html_invalid
|
||
|
(LISTS.keys + FORMS.keys).each do |path|
|
||
|
Redmine::Hook.clear_listeners
|
||
|
get path
|
||
|
without = html_errors
|
||
|
Redmine::Hook.add_listener(MarkerListener)
|
||
|
get path
|
||
|
assert_equal without, html_errors, "The hooks made the HTML of #{path} invalid"
|
||
|
end
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- …
- 9
- 10
- 11
- Next »