some test cleanups and custom_field_form for entities

This commit is contained in:
Alexander Meindl 2022-04-21 19:44:48 +02:00
parent 79722ca0df
commit d920b0f637
4 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,25 @@
<% custom_field_values = entity.custom_field_values.select(&:editable?) %>
<% if custom_field_values.present? %>
<% custom_field_values_full_width = custom_field_values.select { |value| value.custom_field.full_width_layout? } %>
<% custom_field_values -= custom_field_values_full_width %>
<div class="splitcontent">
<div class="splitcontentleft">
<% i = 0 %>
<% split_on = (custom_field_values.size / 2.0).ceil - 1 %>
<% custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label entity_name, value, required: value.custom_field.is_required? %></p>
<% if i == split_on -%>
</div><div class="splitcontentright">
<% end -%>
<% i += 1 -%>
<% end -%>
</div>
</div>
<% custom_field_values_full_width.each do |value| %>
<p><%= custom_field_tag_with_label entity_name, value, required: value.custom_field.is_required? %></p>
<%= wikitoolbar_for "#{entity_name}_custom_field_values_#{value.custom_field_id}", preview_text_path(project_id: entity.project) if value.custom_field.full_text_formatting? %>
<% end %>
<% end %>

View File

@ -106,7 +106,7 @@ module ApiTest
delete '/issues/6.xml', headers: credentials('jsmith')
assert_response :success
assert_equal '', response.body
assert_empty response.body
end
assert_nil Issue.find_by(id: 6)
end

View File

@ -11,7 +11,7 @@ class AdditionalsInfoTest < Additionals::TestCase
def test_system_info
text = AdditionalsInfo.new.system_info
assert_not_equal '', text
assert_not_empty text
assert_not_equal 'unknown', text
end

View File

@ -100,7 +100,7 @@ class ProjectTest < Additionals::TestCase
project.update_attribute :enable_new_ticket_message, '0'
with_plugin_settings 'additionals', new_ticket_message: 'foo' do
assert_equal '', project.active_new_ticket_message
assert_empty project.active_new_ticket_message
end
end