Module: Spree::TestingSupport::FlatpickrCapybara
- Defined in:
- lib/spree/testing_support/flatpickr_capybara.rb
Instance Method Summary collapse
- #fill_in_date_manually(label_text, options = {}) ⇒ Object
- #fill_in_date_picker(label_text, options = {}) ⇒ Object
- #fill_in_date_with_js(label_text, options = {}) ⇒ Object
Instance Method Details
#fill_in_date_manually(label_text, options = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/spree/testing_support/flatpickr_capybara.rb', line 4 def fill_in_date_manually(label_text, = {}) with_open_flatpickr(label_text) do |field| fill_in field[:id], with: string_date() end end |
#fill_in_date_picker(label_text, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/spree/testing_support/flatpickr_capybara.rb', line 10 def fill_in_date_picker(label_text, = {}) if [:hour].blank? && [:minute].blank? flatpickr_date_only(label_text, ) else flatpickr_date_time(label_text, ) end end |
#fill_in_date_with_js(label_text, options = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/spree/testing_support/flatpickr_capybara.rb', line 18 def fill_in_date_with_js(label_text, = {}) date_field = find("input[id='#{label_text}']") script = "document.querySelector('#{date_field}').flatpickr().setDate('#{string_date()}');" page.execute_script(script) end |