Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Attempt fix for promotions date picker.

Matthew Kennedy08a69c484164
diff --git a/backend/spec/features/admin/promotions/promotion_spec.rb b/backend/spec/features/admin/promotions/promotion_spec.rb
index 31191975a2..8cdbcfed48 100644
--- a/backend/spec/features/admin/promotions/promotion_spec.rb
+++ b/backend/spec/features/admin/promotions/promotion_spec.rb
@@ -19,10 +19,11 @@ describe 'Create New Promotion', type: :feature, js: true do
end
it 'Allows you to set a promotion with start and end time' do
- fill_in 'Name', with: 'Promotion 2'
- fill_in 'Code', with: 'Random 2323'
fill_in_date_time_picker('promotion_starts_at', with: '2012-01-24-16-45')
+ fill_in 'Name', with: 'Promotion 2'
+
fill_in_date_time_picker('promotion_expires_at', with: '2012-01-25-22-10')
+ fill_in 'Code', with: 'Random 2323'
click_button 'Create'
diff --git a/core/lib/spree/testing_support/flatpickr_capybara.rb b/core/lib/spree/testing_support/flatpickr_capybara.rb
index ae0d0a8b35..4f6b6ea3b8 100644
--- a/core/lib/spree/testing_support/flatpickr_capybara.rb
+++ b/core/lib/spree/testing_support/flatpickr_capybara.rb
@@ -57,18 +57,18 @@ module Spree
date_field.send_keys :tab # Close the date picker widget
end
- def within_open_flatpickr(label_text)
+ def within_open_flatpickr(label_text, &block)
with_open_flatpickr(label_text) do
- within find(:xpath, "/html/body/div[contains(@class, 'flatpickr-calendar')]") { yield }
+ within find(:xpath, "/html/body/div[contains(@class, 'flatpickr-calendar')]", &block)
end
end
- def within_flatpickr_months
- within find('.flatpickr-months .flatpickr-month .flatpickr-current-month') { yield }
+ def within_flatpickr_months(&block)
+ within find('.flatpickr-months .flatpickr-month .flatpickr-current-month', &block)
end
- def within_flatpickr_time
- within find('.flatpickr-time') { yield }
+ def within_flatpickr_time(&block)
+ within find('.flatpickr-time', &block)
end
def select_flatpickr_month(month)
@@ -85,8 +85,8 @@ module Spree
end
end
- def within_flatpickr_days
- within find('.flatpickr-innerContainer > .flatpickr-rContainer > .flatpickr-days') { yield }
+ def within_flatpickr_days(&block)
+ within find('.flatpickr-innerContainer > .flatpickr-rContainer > .flatpickr-days', &block)
end
def select_flatpickr_hour(hour)