Test pass: test_index_table_header_close_exposure
Allow closing last quantity column
This commit is contained in:
parent
a29eba9861
commit
80b10d108a
@ -59,7 +59,8 @@ module BodyTrackersHelper
|
||||
# * int > 0 - quantity name-labelled cell with 'int' size colspan
|
||||
# * int < 0 - quantity name-labelled cell with 'int' size rowspan
|
||||
# * 0 - non-labelled cell without col-/rowspan
|
||||
spec = []
|
||||
spec = [Hash.new(0)]
|
||||
return spec if quantities.empty?
|
||||
default_row = Hash.new(0)
|
||||
|
||||
# Determine colspans first...
|
||||
|
@ -63,7 +63,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% next unless @quantities.length > 0 %>
|
||||
<% next if @quantities.empty? %>
|
||||
<% extra_quantities.each_slice(@quantities.length) do |eqs| %>
|
||||
<tr class="extra <%= row_class %>" style="display:none">
|
||||
<% eqs.each do |q| %>
|
||||
|
@ -15,8 +15,9 @@
|
||||
<% header.each_with_index do |row, i| %>
|
||||
<tr class="header">
|
||||
<% if i == 0 %>
|
||||
<th rowspan="<%= header.length %>"
|
||||
style="width:<%= 2 * 100/total_width %>%"><%= l(:field_effective_from) %></th>
|
||||
<th rowspan="<%= header.length %>" style="width:<%= 2 * 100/total_width %>%">
|
||||
<%= l(:field_effective_from) %>
|
||||
</th>
|
||||
<% end %>
|
||||
|
||||
<% row.each do |q, span| %>
|
||||
@ -83,9 +84,12 @@
|
||||
<%= q.name %><p class="value"><%= targets.delete(q) %></p>
|
||||
</td>
|
||||
<% end %>
|
||||
<td rowspan="<%= rows %>" class="action unwrappable"><%= action_links(date) %></td>
|
||||
<td rowspan="<%= rows %>" class="action unwrappable">
|
||||
<%= action_links(date) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% next if @quantities.empty? %>
|
||||
<% targets.each_slice(@quantities.length) do |extras| %>
|
||||
<tr class="extra <%= row_class %>" style="display:none">
|
||||
<% extras.each do |q, t| %>
|
||||
|
@ -31,6 +31,15 @@ class TargetsTest < BodyTrackingSystemTestCase
|
||||
assert_selector 'table#targets thead th', text: quantities(:quantities_proteins).name
|
||||
end
|
||||
|
||||
def test_index_table_header_close_exposure
|
||||
visit project_targets_path(@project1)
|
||||
within 'table#targets thead th', text: quantities(:quantities_energy).name do
|
||||
click_link class: 'icon-close'
|
||||
end
|
||||
assert_no_selector 'table#targets thead th', text: quantities(:quantities_energy).name
|
||||
assert_selector 'table#targets thead th'
|
||||
end
|
||||
|
||||
# TODO: rename to test_new; move checking of default values here
|
||||
def test_index_show_and_hide_new_target_form
|
||||
visit project_targets_path(@project1)
|
||||
|
Reference in New Issue
Block a user