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

[#54378] add calendar specs

Tobias Dillmann4987bc5944bf
diff --git a/modules/calendar/spec/features/calendar_widget_spec.rb b/modules/calendar/spec/features/calendar_widget_spec.rb
index ae527265e45..99c2731a422 100644
--- a/modules/calendar/spec/features/calendar_widget_spec.rb
+++ b/modules/calendar/spec/features/calendar_widget_spec.rb
@@ -122,4 +122,21 @@ RSpec.describe "Calendar Widget", :js, with_settings: { start_of_week: 1 } do
work_package.reload
expect(work_package.due_date).to eq Time.zone.today.beginning_of_week.next_occurring(:tuesday)
end
+
+ context "when looking at the date headers" do
+ let(:next_tuesday) { Time.zone.today.beginning_of_week.next_occurring(:tuesday) }
+ let(:tue_css_selector) { ".fc-day-tue .fc-col-header-cell-cushion" }
+
+ it "shows the default date format" do
+ expected = /Tue #{next_tuesday.month}\/#{next_tuesday.day}/
+ expect(page).to have_css(tue_css_selector, text: expected)
+ end
+
+ context "with a date format configured", with_settings: { date_format: "%d.%m.%Y" } do
+ it "shows the configured date format" do
+ expected = /Tue #{next_tuesday.day.to_s.rjust(2, '0')}\.#{next_tuesday.month.to_s.rjust(2, '0')}\./
+ expect(page).to have_css(tue_css_selector, text: expected)
+ end
+ end
+ end
end
diff --git a/modules/calendar/spec/features/calendars_spec.rb b/modules/calendar/spec/features/calendars_spec.rb
index 569a95ab5af..9fdddcb8524 100644
--- a/modules/calendar/spec/features/calendars_spec.rb
+++ b/modules/calendar/spec/features/calendars_spec.rb
@@ -94,6 +94,10 @@ RSpec.describe "Work package calendars", :js do
expect(page)
.to have_no_css ".fc-event-title", text: another_future_work_package.subject
+ # The columns are set correctly according to month view.
+ expect(page).to have_css ".fc-day-mon .fc-col-header-cell-cushion", text: "Mon"
+ expect(page).to have_css ".fc-day-tue .fc-col-header-cell-cushion", text: "Tue"
+
filters.expect_filter_count 1
filters.open