diff --git a/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview.rb b/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview.rb deleted file mode 100644 index a13f22022fb..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class SolidusAdmin::Layout::Feedback::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - def overview - render_with_template - end -end diff --git a/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview/overview.html.erb deleted file mode 100644 index 59ff865e76e..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/feedback/component_preview/overview.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
- <%= render current_component.new %> -
diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview.rb b/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview.rb deleted file mode 100644 index b46f8c1cd22..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -# @component "layout/navigation/account" -class SolidusAdmin::Layout::Navigation::Account::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - def overview - render_with_template - end - - # @param user_label text - def playground(user_label: "Alice Doe") - render_with_template( - locals: { - user_label: user_label - } - ) - end -end diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/overview.html.erb deleted file mode 100644 index 210dc2804d1..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/overview.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -
-
- Short name -
- -
- <%= render current_component.new( - user_label: "Alice Doe", - account_path: "#account", - logout_path: "#logout", - logout_method: :delete - ) %> -
-
- -
-
- Long name -
- -
- <%= render current_component.new( - user_label: "Alice Supercalifragilisticexpialidocious", - account_path: "#account", - logout_path: "#logout", - logout_method: :delete - ) %> -
-
diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/playground.html.erb b/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/playground.html.erb deleted file mode 100644 index 5c075fad646..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/account/component_preview/playground.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
- <%= render current_component.new( - user_label: user_label - ) %> -
-
-
diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/component_preview.rb b/admin/spec/components/previews/solidus_admin/layout/navigation/component_preview.rb deleted file mode 100644 index b9081974bf6..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/component_preview.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require "solidus_admin/menu_item" - -# @component "layout/navigation" -class SolidusAdmin::Layout::Navigation::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - # The item component is used to render main navigation items, which are - # rendered within the sidebar. - # - # It needs to be passed a {SolidusAdmin::MenuItem} instance, which - # represents the data for a main navigation item. - # - # ```ruby - # item = SolidusAdmin::MenuItem.new( - # key: :overview, - # position: 80 - # ) - # render component("layout/navigation/item", item: item) - # ``` - # - # @param store_name text - # @param store_url url - # @param logo_path text { description: "Asset path to the store logo" } - def overview(store_name: "Solidus store", store_url: "https://example.com", logo_path: SolidusAdmin::Config.logo_path) - store = Struct.new(:name, :url).new(store_name, store_url) - - render current_component.new( - store: store, - logo_path: logo_path, - ) - end -end diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview.rb b/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview.rb deleted file mode 100644 index b97b1c00392..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "solidus_admin/menu_item" - -# @component "layout/navigation/item" -class SolidusAdmin::Layout::Navigation::Item::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - DUMMY_ROUTE = :foo_path - - DUMMY_PATH = "#" - - # @param active toggle { description: "Whether the item is active" } - # @param key text { description: "ID also used for i18n" } - # @param icon text { description: "RemixIcon name (https://remixicon.com/)" } - def overview(active: false, key: "orders", icon: "inbox-line") - item = SolidusAdmin::MenuItem.new( - key: key, - icon: icon, - position: 1, - route: DUMMY_ROUTE - ) - - render_with_template( - locals: { - item: item, - url_helpers: url_helpers, - fullpath: fullpath(active) - } - ) - end - - private - - # solidus_admin.foo_path => "#" - def url_helpers - Struct.new(:solidus_admin).new( - Struct.new(DUMMY_ROUTE).new(DUMMY_PATH) - ) - end - - def fullpath(active) - active ? DUMMY_PATH : "" - end -end diff --git a/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview/overview.html.erb deleted file mode 100644 index d8df49071d0..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/navigation/item/component_preview/overview.html.erb +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/admin/spec/components/previews/solidus_admin/layout/skip_link/component_preview.rb b/admin/spec/components/previews/solidus_admin/layout/skip_link/component_preview.rb deleted file mode 100644 index 0e77ca3f9a8..00000000000 --- a/admin/spec/components/previews/solidus_admin/layout/skip_link/component_preview.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -# @component "layout/skip_link" -class SolidusAdmin::Layout::SkipLink::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - # Click on the "Preview" window area and press "Tab" to see the skip link - def overview - render current_component.new(href: "#") - end -end diff --git a/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview.rb b/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview.rb deleted file mode 100644 index 4279afad087..00000000000 --- a/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -# @component "orders/show/address" -class SolidusAdmin::Orders::Show::Address::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - def overview - type = "ship" - order = fake_order(type) - - render_with_template( - locals: { - order: order, - address: order.send("#{type}_address"), - type: type - } - ) - end - - # @param type select :type_options - def playground(type: "ship") - order = fake_order(type) - render current_component.new(order: order, address: order.send("#{type}_address"), type: type) - end - - private - - def fake_order(type) - order = Spree::Order.new - country = Spree::Country.find_or_initialize_by(iso: Spree::Config.default_country_iso) - - order.define_singleton_method(:id) { 1 } - order.define_singleton_method(:persisted?) { true } - order.define_singleton_method(:to_param) { id.to_s } - order.send("build_#{type}_address", { country: country }) - order - end - - def type_options - current_component::VALID_TYPES - end -end diff --git a/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview/overview.html.erb deleted file mode 100644 index a5b1b6ac203..00000000000 --- a/admin/spec/components/previews/solidus_admin/orders/show/address/component_preview/overview.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render current_component.new(order: order, address: address, type: type) %> diff --git a/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview.rb b/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview.rb deleted file mode 100644 index 3d9adbf7d7b..00000000000 --- a/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -# @component "orders/show/summary" -class SolidusAdmin::Orders::Show::Summary::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - def overview - order = fake_order(item_total: 340, additional_tax_total: 10, shipment_total: 20, promo_total: 10, adjustment_total: 20) - render_with_template(locals: { order: order }) - end - - # @param item_total [Float] - # @param additional_tax_total [Float] - # @param shipment_total [Float] - # @param promo_total [Float] - # @param adjustment_total [Float] - def playground(item_total: 100, additional_tax_total: 10, shipment_total: 5, promo_total: 0, adjustment_total: 0) - fake_order = fake_order( - item_total: item_total, - additional_tax_total: additional_tax_total, - shipment_total: shipment_total, - promo_total: promo_total, - adjustment_total: adjustment_total - ) - - render current_component.new(order: fake_order) - end - - private - - def fake_order(item_total:, additional_tax_total:, shipment_total:, promo_total:, adjustment_total:) - order = Spree::Order.new - - order.define_singleton_method(:item_total) { item_total } - order.define_singleton_method(:additional_tax_total) { additional_tax_total } - order.define_singleton_method(:shipment_total) { shipment_total } - order.define_singleton_method(:promo_total) { promo_total } - order.define_singleton_method(:adjustment_total) { adjustment_total } - order.define_singleton_method(:total) { - item_total.to_f + additional_tax_total.to_f + shipment_total.to_f - promo_total.to_f - adjustment_total.to_f - } - - order - end -end diff --git a/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview/overview.html.erb deleted file mode 100644 index 2135e5da8fb..00000000000 --- a/admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview/overview.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render current_component.new(order: order) %> diff --git a/admin/spec/components/previews/solidus_admin/products/status/component_preview.rb b/admin/spec/components/previews/solidus_admin/products/status/component_preview.rb deleted file mode 100644 index e04545090cd..00000000000 --- a/admin/spec/components/previews/solidus_admin/products/status/component_preview.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# @component "products/status" -class SolidusAdmin::Products::Status::ComponentPreview < ViewComponent::Preview - include SolidusAdmin::Preview - - def overview - render_with_template - end -end diff --git a/admin/spec/components/previews/solidus_admin/products/status/component_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/products/status/component_preview/overview.html.erb deleted file mode 100644 index 3fad845c74a..00000000000 --- a/admin/spec/components/previews/solidus_admin/products/status/component_preview/overview.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -
-
- Available -
- - <%= render current_component.new(status: :available) %> -
- -
-
- Discontinued -
- - <%= render current_component.new(status: :discontinued) %> -
diff --git a/admin/spec/components/previews/solidus_admin/typography/typography_preview.rb b/admin/spec/components/previews/solidus_admin/typography/typography_preview.rb deleted file mode 100644 index 4830bf57bfd..00000000000 --- a/admin/spec/components/previews/solidus_admin/typography/typography_preview.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require "solidus_admin/menu_item" - -class SolidusAdmin::Typography::TypographyPreview < ViewComponent::Preview - layout "solidus_admin/preview" - - # Typography showcase - # - # Showcase of the custom Tailwind classes available for typography. It doesn't - # correspond to a specific component. - def overview - render_with_template - end -end diff --git a/admin/spec/components/previews/solidus_admin/typography/typography_preview/overview.html.erb b/admin/spec/components/previews/solidus_admin/typography/typography_preview/overview.html.erb deleted file mode 100644 index 80fad0b648b..00000000000 --- a/admin/spec/components/previews/solidus_admin/typography/typography_preview/overview.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<% - [ - 'font-normal text-xs', - 'font-semibold text-xs', - 'font-normal text-sm', - 'font-semibold text-sm', - 'font-normal text-base', - 'font-semibold text-base', - 'font-semibold text-xl', - ].each do |klass_name| -%> -
-

<%= klass_name %>

-

- The quick brown fox jumps over the lazy dog. -

-
-<% end %> diff --git a/admin/spec/components/solidus_admin/layout/feedback/component_spec.rb b/admin/spec/components/solidus_admin/layout/feedback/component_spec.rb deleted file mode 100644 index f9afb51f097..00000000000 --- a/admin/spec/components/solidus_admin/layout/feedback/component_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Layout::Feedback::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end -end diff --git a/admin/spec/components/solidus_admin/layout/navigation/account/component_spec.rb b/admin/spec/components/solidus_admin/layout/navigation/account/component_spec.rb index 56d4d80b0eb..e4dfbaf3094 100644 --- a/admin/spec/components/solidus_admin/layout/navigation/account/component_spec.rb +++ b/admin/spec/components/solidus_admin/layout/navigation/account/component_spec.rb @@ -3,10 +3,6 @@ require "spec_helper" RSpec.describe SolidusAdmin::Layout::Navigation::Account::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end - it "renders correctly" do component = described_class.new( user_label: "Alice", diff --git a/admin/spec/components/solidus_admin/layout/navigation/component_spec.rb b/admin/spec/components/solidus_admin/layout/navigation/component_spec.rb deleted file mode 100644 index f5480e5977a..00000000000 --- a/admin/spec/components/solidus_admin/layout/navigation/component_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Layout::Navigation::Component, type: :component do - before { allow(vc_test_controller).to receive(:spree_current_user).and_return(build(:user)) } - - it "renders the overview preview" do - render_preview(:overview) - end - - it "renders the solidus logo" do - component = described_class.new( - store: build(:store), - items: [] - ) - - render_inline(component) - - expect(page).to have_css("img[src*='logo/solidus']") - end - - it "renders the store link" do - component = described_class.new( - store: build(:store, url: "https://example.com"), - items: [] - ) - - render_inline(component) - - expect(page).to have_content("https://example.com") - end - - it "renders the account nav component" do - account_component = mock_component do - def call - "account nav".html_safe - end - end - component = described_class.new( - store: build(:store), - items: [], - ) - allow(component).to receive(:component).and_call_original - allow(component).to receive(:component).with('layout/navigation/account').and_return(account_component) - - render_inline(component) - - expect(page).to have_content("account nav") - end -end diff --git a/admin/spec/components/solidus_admin/layout/navigation/item/component_spec.rb b/admin/spec/components/solidus_admin/layout/navigation/item/component_spec.rb deleted file mode 100644 index edc230ea2c6..00000000000 --- a/admin/spec/components/solidus_admin/layout/navigation/item/component_spec.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Layout::Navigation::Item::Component, type: :component do - def url_helpers(solidus_admin: {}, spree: {}) - double( - solidus_admin: double(**solidus_admin), - spree: double(**spree) - ) - end - - it "renders the overview preview" do - render_preview(:overview) - end - - it "renders the item" do - item = SolidusAdmin::MenuItem.new(key: "orders", route: :orders_path, position: 1) - component = described_class.new( - item: item, - url_helpers: url_helpers(solidus_admin: { orders_path: "/admin/foo" }) - ) - - render_inline(component) - - expect(page).to have_content("Orders") - end - - it "renders nested items" do - item = SolidusAdmin::MenuItem.new(key: "products", route: :products_path, position: 1, children: [ - SolidusAdmin::MenuItem.new(key: "option_types", route: :option_types_path, position: 1, top_level: false) - ]) - component = described_class.new( - item: item, - url_helpers: url_helpers(solidus_admin: { products_path: "/admin/products", option_types_path: "/admin/option_types" }) - ) - - render_inline(component) - - expect(page).to have_content("Option Types") - end - - it "syles top level items differently from nested items" do - item = SolidusAdmin::MenuItem.new(key: "products", route: :products_path, position: 1, children: [ - SolidusAdmin::MenuItem.new(key: "option_types", route: :option_types_path, position: 1, top_level: false) - ]) - component = described_class.new( - item: item, - url_helpers: url_helpers(solidus_admin: { products_path: "/admin/products", option_types_path: "/admin/option_types" }) - ) - - render_inline(component) - - expect( - page.find("a", text: "Products")[:class] - ).not_to eq( - page.find("a", text: "Option Types")[:class] - ) - end - - it "syles active items differently from the others" do - inactive_item = SolidusAdmin::MenuItem - .new(key: "orders", route: :orders_path, position: 1) - active_item = SolidusAdmin::MenuItem - .new(key: "products", route: :products_path, position: 1) - inactive_component = described_class.new( - item: inactive_item, - url_helpers: url_helpers(solidus_admin: { orders_path: "/admin/orders" }), - fullpath: "/admin/products" - ) - active_component = described_class.new( - item: active_item, - url_helpers: url_helpers(solidus_admin: { products_path: "/admin/products" }), - fullpath: "/admin/products" - ) - - render_inline(inactive_component) - inactive_classes = page.find("a", text: "Orders")[:class] - render_inline(active_component) - active_classes = page.find("a", text: "Products")[:class] - - expect(inactive_classes).not_to eq(active_classes) - end -end diff --git a/admin/spec/components/solidus_admin/layout/skip_link/component_spec.rb b/admin/spec/components/solidus_admin/layout/skip_link/component_spec.rb deleted file mode 100644 index a5614da73e5..00000000000 --- a/admin/spec/components/solidus_admin/layout/skip_link/component_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Layout::SkipLink::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end -end diff --git a/admin/spec/components/solidus_admin/orders/show/address/component_spec.rb b/admin/spec/components/solidus_admin/orders/show/address/component_spec.rb deleted file mode 100644 index bb0cc9a95e2..00000000000 --- a/admin/spec/components/solidus_admin/orders/show/address/component_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Orders::Show::Address::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end -end diff --git a/admin/spec/components/solidus_admin/orders/show/summary/component_spec.rb b/admin/spec/components/solidus_admin/orders/show/summary/component_spec.rb deleted file mode 100644 index af06d88e8bb..00000000000 --- a/admin/spec/components/solidus_admin/orders/show/summary/component_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -RSpec.describe SolidusAdmin::Orders::Show::Summary::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end -end diff --git a/admin/spec/components/solidus_admin/products/status/component_spec.rb b/admin/spec/components/solidus_admin/products/status/component_spec.rb index 7a705f01505..87ecedb0909 100644 --- a/admin/spec/components/solidus_admin/products/status/component_spec.rb +++ b/admin/spec/components/solidus_admin/products/status/component_spec.rb @@ -3,10 +3,6 @@ require "spec_helper" RSpec.describe SolidusAdmin::Products::Status::Component, type: :component do - it "renders the overview preview" do - render_preview(:overview) - end - describe "#status" do it "returns :available when the product is available" do product = Spree::Product.new(available_on: Time.current)