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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Added NavigationHelper#should_render_internationalization_dropdown?
Damian Legawiec230ed11f1c9e
diff --git a/frontend/app/helpers/spree/navigation_helper.rb b/frontend/app/helpers/spree/navigation_helper.rbindex e584f9fa5c..a8958d584b 100644--- a/frontend/app/helpers/spree/navigation_helper.rb+++ b/frontend/app/helpers/spree/navigation_helper.rb@@ -28,6 +28,11 @@ module Spree)end+ def should_render_internationalization_dropdown?+ (defined?(should_render_locale_dropdown?) && should_render_locale_dropdown?) ||+ (defined?(should_render_currency_dropdown?) && should_render_currency_dropdown?)+ end+privatedef spree_navigation_data_cache_keydiff --git a/frontend/spec/helpers/navigation_helper_spec.rb b/frontend/spec/helpers/navigation_helper_spec.rbnew file mode 100644index 0000000000..76905a1122--- /dev/null+++ b/frontend/spec/helpers/navigation_helper_spec.rb@@ -0,0 +1,34 @@+require 'spec_helper'++module Spree+ describe NavigationHelper, type: :helper do+ include Spree::CurrencyHelper+ include Spree::LocaleHelper++ describe '#should_render_internationalization_dropdown?' do+ context 'store with multiple currencies' do+ let(:current_store) { create(:store, supported_currencies: 'EUR,USD') }++ it { expect(should_render_internationalization_dropdown?).to be_truthy }+ end++ context 'store with multiple locales' do+ let(:current_store) { create(:store, supported_locales: 'en,fr') }++ it { expect(should_render_internationalization_dropdown?).to be_truthy }+ end++ context 'store with multiple currencies and locales' do+ let(:current_store) { create(:store, supported_currencies: 'EUR,USD', supported_locales: 'en,fr') }++ it { expect(should_render_internationalization_dropdown?).to be_truthy }+ end++ context 'store with single currency and locale' do+ let(:current_store) { create(:store, supported_currencies: nil, supported_locales: nil) }++ it { expect(should_render_internationalization_dropdown?).to be_falsey }+ end+ end+ end+end