Ensure we're navigating to the date we're testing

Today, the start of the week monday is not shown in calendar
pull/12008/head
Oliver Günther 2 years ago
parent 7e8e9c1323
commit a452c05f61
  1. 4
      spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
  2. 15
      spec/support/components/datepicker/datepicker.rb

@ -68,10 +68,10 @@ describe 'Datepicker modal individual non working days (WP #44453)',
# Wait for the datepicker to be initialized # Wait for the datepicker to be initialized
datepicker.expect_visible datepicker.expect_visible
datepicker.show_date non_working_day_this_week.date
datepicker.expect_non_working non_working_day_this_week.date datepicker.expect_non_working non_working_day_this_week.date
datepicker.select_year non_working_day_next_year.date.year datepicker.show_date non_working_day_next_year.date
datepicker.select_month non_working_day_next_year.date.month
datepicker.expect_non_working non_working_day_next_year.date datepicker.expect_non_working non_working_day_next_year.date
end end

@ -65,13 +65,22 @@ module Components
end end
end end
## # Change the datepicker visible area.
# Set a ISO8601 date through the datepicker #
def set_date(date) # @param date the date to navigate to. Can be a Date or a String with
# ISO8601 formatted date.
def show_date(date)
date = Date.parse(date) unless date.is_a?(Date) date = Date.parse(date) unless date.is_a?(Date)
select_year date.year select_year date.year
select_month date.strftime('%B') select_month date.strftime('%B')
end
# Set a ISO8601 date through the datepicker
def set_date(date)
date = Date.parse(date) unless date.is_a?(Date)
show_date(date)
select_day date.day select_day date.day
end end

Loading…
Cancel
Save