Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Update specs

Mir Bhatiad05dc5eb0bff
diff --git a/app/components/table_component.rb b/app/components/table_component.rb
index 5a3c186661a..fd5d0ba28d0 100644
--- a/app/components/table_component.rb
+++ b/app/components/table_component.rb
@@ -146,7 +146,7 @@ class TableComponent < ApplicationComponent
end
def test_selector
- self.class.name.dasherize
+ options.fetch(:test_selector) { self.class.name.dasherize }
end
def rows
diff --git a/modules/meeting/app/components/recurring_meetings/table_header_component.html.erb b/modules/meeting/app/components/recurring_meetings/table_header_component.html.erb
index ca857599766..4a8c64331e9 100644
--- a/modules/meeting/app/components/recurring_meetings/table_header_component.html.erb
+++ b/modules/meeting/app/components/recurring_meetings/table_header_component.html.erb
@@ -30,7 +30,7 @@ See COPYRIGHT and LICENSE files for more details.
<%=
component_wrapper do
flex_layout do |flex|
- flex.with_row(mb: 2, mt: planned) do
+ flex.with_row(mb: 2, mt: @planned ? 5 : 0) do
flex_layout(justify_content: :space_between) do |container|
container.with_column do
render(Primer::Beta::Heading.new(tag: :h3)) { @title }
diff --git a/modules/meeting/app/components/recurring_meetings/table_header_component.rb b/modules/meeting/app/components/recurring_meetings/table_header_component.rb
index f8731af8920..84054b8179d 100644
--- a/modules/meeting/app/components/recurring_meetings/table_header_component.rb
+++ b/modules/meeting/app/components/recurring_meetings/table_header_component.rb
@@ -42,11 +42,5 @@ module RecurringMeetings
@subtitle = subtitle
@planned = planned
end
-
- private
-
- def planned
- @planned ? 5 : 0
- end
end
end
diff --git a/modules/meeting/app/controllers/recurring_meetings_controller.rb b/modules/meeting/app/controllers/recurring_meetings_controller.rb
index 7f607662c20..cdab022c30f 100644
--- a/modules/meeting/app/controllers/recurring_meetings_controller.rb
+++ b/modules/meeting/app/controllers/recurring_meetings_controller.rb
@@ -242,8 +242,8 @@ class RecurringMeetingsController < ApplicationController
# Planned meetings consist of scheduled occurrences and cancelled meetings
# Open meetings are removed from the scheduled occurrences as they are displayed separately
planned = @recurring_meeting
- .scheduled_occurrences(limit: count + instantiated.count)
- .reject { |start_time| instantiated.include?(start_time) }
+ .scheduled_occurrences(limit: count + opened.count)
+ .reject { |start_time| opened.include?(start_time) }
.map { |start_time| cancelled[start_time] || scheduled_meeting(start_time) }
.first(count)
diff --git a/modules/meeting/app/views/recurring_meetings/show.html.erb b/modules/meeting/app/views/recurring_meetings/show.html.erb
index ba3cad360e3..81e2184a738 100644
--- a/modules/meeting/app/views/recurring_meetings/show.html.erb
+++ b/modules/meeting/app/views/recurring_meetings/show.html.erb
@@ -36,11 +36,40 @@ See COPYRIGHT and LICENSE files for more details.
<%= no_results_box %>
<% else -%>
<% if @direction == "past" -%>
- <%= render RecurringMeetings::TableComponent.new(rows: @meetings, current_project: @project, count: @count, direction: @direction, max_count: @max_count) %>
+ <%= render RecurringMeetings::TableComponent.new(
+ rows: @meetings,
+ current_project: @project,
+ count: @count,
+ direction: @direction,
+ max_count: @max_count
+ ) %>
<% else -%>
- <%= render RecurringMeetings::TableHeaderComponent.new(meeting: @recurring_meeting, title: I18n.t("recurring_meeting.agenda_opened.title"), subtitle: I18n.t("recurring_meeting.agenda_opened.subtitle")) %>
- <%= render RecurringMeetings::TableComponent.new(rows: @meetings, current_project: @project, count: @count, direction: @direction, max_count: @max_count) %>
- <%= render RecurringMeetings::TableHeaderComponent.new(meeting: @recurring_meeting, title: I18n.t("recurring_meeting.planned.title"), subtitle: I18n.t("recurring_meeting.planned.subtitle"), planned: true) %>
- <%= render RecurringMeetings::TableComponent.new(rows: @planned_meetings, current_project: @project, count: @count, direction: @direction, max_count: @max_count) %>
+ <%= render RecurringMeetings::TableHeaderComponent.new(
+ meeting: @recurring_meeting,
+ title: I18n.t("recurring_meeting.agenda_opened.title"),
+ subtitle: I18n.t("recurring_meeting.agenda_opened.subtitle")
+ ) %>
+ <%= render RecurringMeetings::TableComponent.new(
+ rows: @meetings,
+ current_project: @project,
+ count: @count,
+ direction: @direction,
+ max_count: @max_count,
+ test_selector: "agenda-opened-table"
+ ) %>
+ <%= render RecurringMeetings::TableHeaderComponent.new(
+ meeting: @recurring_meeting,
+ title: I18n.t("recurring_meeting.planned.title"),
+ subtitle: I18n.t("recurring_meeting.planned.subtitle"),
+ planned: true
+ ) %>
+ <%= render RecurringMeetings::TableComponent.new(
+ rows: @planned_meetings,
+ current_project: @project,
+ count: @count,
+ direction: @direction,
+ max_count: @max_count,
+ test_selector: "planned-table"
+ ) %>
<% end -%>
<% end -%>
diff --git a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb
index 587a96d121a..ca3bd9636c8 100644
--- a/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb
+++ b/modules/meeting/spec/requests/recurring_meetings/recurring_meetings_show_spec.rb
@@ -88,6 +88,44 @@ RSpec.describe "Recurring meetings show",
end
end
+ describe "upcoming tab" do
+ let!(:upcoming_open_meeting) do
+ create(:structured_meeting, recurring_meeting:, start_time: Time.zone.today + 10.hours, state: :open)
+ end
+ let!(:open_meeting) do
+ create :scheduled_meeting,
+ meeting: upcoming_open_meeting,
+ recurring_meeting:,
+ start_time: Time.zone.today + 1.day + 10.hours
+ end
+
+ let!(:cancelled_meeting) do
+ create :scheduled_meeting,
+ recurring_meeting:,
+ start_time: Time.zone.today + 2.days + 10.hours,
+ cancelled: true
+ end
+
+ it "sorts meetings into two tables based on state" do
+ get recurring_meeting_path(recurring_meeting)
+
+ content = page.find_by_id("content")
+ expect(content).to have_text "Agenda opened"
+ expect(content).to have_text "Planned"
+
+ open_meeting_date = format_time(open_meeting.start_time)
+ cancelled_meeting_date = format_time(cancelled_meeting.start_time)
+ scheduled_meeting_date = format_time(Time.zone.today + 2.days + 10.hours)
+
+ agenda_opened = page.find("[data-test-selector='agenda-opened-table']")
+ expect(agenda_opened).to have_text open_meeting_date
+
+ planned = page.find("[data-test-selector='planned-table']")
+ expect(planned).to have_text cancelled_meeting_date
+ expect(planned).to have_text scheduled_meeting_date
+ end
+ end
+
describe "upcoming quick filter" do
context "with a rescheduled meeting" do
let!(:rescheduled_instance) do