Add time entries custom fields to the context menu for quick bulk edit (#17484).

git-svn-id: http://svn.redmine.org/redmine/trunk@13335 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-07-29 17:52:27 +00:00
parent 41e7210210
commit efc05bc73c
5 changed files with 63 additions and 0 deletions

View File

@@ -250,6 +250,23 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_select 'a:not(.disabled)', :text => 'Edit'
end
def test_time_entries_context_menu_should_include_custom_fields
field = TimeEntryCustomField.generate!(:name => "Field", :field_format => "list", :possible_values => ["foo", "bar"])
@request.session[:user_id] = 2
get :time_entries, :ids => [1, 2]
assert_response :success
assert_select "li.cf_#{field.id}" do
assert_select 'a[href=#]', :text => "Field"
assert_select 'ul' do
assert_select 'a', 3
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=foo", :text => 'foo'
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=bar", :text => 'bar'
assert_select 'a[href=?]', "/time_entries/bulk_update?ids%5B%5D=1&amp;ids%5B%5D=2&amp;time_entry%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
end
end
end
def test_time_entries_context_menu_without_edit_permission
@request.session[:user_id] = 2
Role.find_by_name('Manager').remove_permission! :edit_time_entries