discourse/spec/system/page_objects/components/calendar_date_time_picker.rb
Martin Brennan fb36af7799
DEV: Move calendar date + time picker from local dates into core component (#23023)
This commit moves the calendar date and time picker shown in
the local dates modal into a core component that can be reused
in other places. Also add system specs to make sure there isn't
any breakages with this feature, and a section to the styleguide.
2023-08-11 13:05:44 +10:00

31 lines
683 B
Ruby

# frozen_string_literal: true
module PageObjects
module Components
class CalendarDateTimePicker < PageObjects::Components::Base
def initialize(context)
@context = context
end
def component
find(@context)
end
def select_day(day_number)
component.find("button.pika-button.pika-day[data-pika-day='#{day_number}']").click
end
def select_year(year)
component
.find(".pika-select-year", visible: false)
.find("option[value='#{year}']")
.select_option
end
def fill_time(time)
component.find(".time-picker").fill_in(with: time)
end
end
end
end