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

Fix datepicker spec for both multi and single month datepickers

Benjamin Bädorf07bf01c432c1
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index ba59e6141da..8f07313cfaa 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -15,7 +15,13 @@ module Components
def select_month(month)
month = Date::MONTHNAMES.index(month) if month.is_a?(String)
retry_block do
- current_month = flatpickr_container.first('.flatpickr-monthDropdown-months').value.to_i + 1
+ # This is for a double-month datepicker
+ current_month = Date::MONTHNAMES.index(flatpickr_container.first('.cur-month').text)
+ if current_month == nil
+ # This is for a single-month datepicker
+ current_month = flatpickr_container.first('.flatpickr-monthDropdown-months').value.to_i + 1
+ end
+
if current_month < month
while current_month < month