Fix tests

This commit is contained in:
Andy Smith
2025-05-13 16:39:11 -05:00
parent 05aa2e3fb9
commit b539cd1ed1
4 changed files with 6 additions and 33 deletions
+1
View File
@@ -77,6 +77,7 @@
background-color: var(--color-canvas);
grid-row-start: 2;
inset-block-start: calc(var(--events-gap) * -2);
margin-block-end: var(--events-gap);
padding-block: calc(var(--events-gap) * 3) var(--events-gap);
position: sticky;
z-index: var(--z-events-column-header);
+2 -30
View File
@@ -1,6 +1,5 @@
module EventsHelper
def event_column_info(event_type, day_timeline)
def event_columns(event_type, day_timeline)
case event_type
when "added"
events = day_timeline.events.where(action: "card_published")
@@ -20,17 +19,11 @@ module EventsHelper
{
title: "Updated",
index: 2,
events: day_timeline.events.where.not(action: ["card_published", "card_closed"])
events: day_timeline.events.where.not(action: [ "card_published", "card_closed" ])
}
end
end
def event_column(event)
case event.action
when "card_closed"
@@ -54,27 +47,6 @@ module EventsHelper
end
end
def render_event_grid_cells(columns: 4, rows: 24)
safe_join((2..rows + 1).map do |row|
(1..columns).map do |col|
tag.div class: class_names("event__grid-item"), style: "grid-area: #{row}/#{col};"
end
end.flatten)
end
def render_column_headers(day_timeline)
headers = {
"Added" => day_timeline.events.where(action: "card_published").count,
"Updated" => nil,
"Closed" => day_timeline.events.where(action: "card_closed").count
}
headers.map do |header, count|
title = count&.positive? ? "#{header} (#{count})" : header
content_tag(:h3, title, class: "event__grid-column-title position-sticky")
end.join.html_safe
end
def event_action_sentence(event)
if event.action.comment_created?
comment_event_action_sentence(event)
@@ -1,4 +1,4 @@
<% column = event_column_info(event_type, day_timeline) %>
<% column = event_columns(event_type, day_timeline) %>
<div class="events__column">
<h3 class="events__column-header"><%= column[:title] %></h3>
+2 -2
View File
@@ -11,7 +11,7 @@ class EventsControllerTest < ActionDispatch::IntegrationTest
test "index" do
get events_path
assert_select "ul.event__time-block[style='grid-area: 17/2']" do
assert_select "ul.events__time-block[style='grid-area: 17/2']" do
assert_select "strong", text: "David assigned JZ to Layout is broken"
end
end
@@ -21,7 +21,7 @@ class EventsControllerTest < ActionDispatch::IntegrationTest
get events_path
assert_select "ul.event__time-block[style='grid-area: 22/2']" do
assert_select "ul.events__time-block[style='grid-area: 22/2']" do
assert_select "strong", text: "David assigned JZ to Layout is broken"
end
end