From 938730614e6b5e719820a6ba9af21ee5bd70bbad Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Fri, 15 Sep 2023 15:21:08 +0200 Subject: [PATCH 1/4] Remove a leftover reference in ui/toggletip component --- admin/app/components/solidus_admin/ui/toggletip/component.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/app/components/solidus_admin/ui/toggletip/component.rb b/admin/app/components/solidus_admin/ui/toggletip/component.rb index 417fd7c68a8..03d10c38f21 100644 --- a/admin/app/components/solidus_admin/ui/toggletip/component.rb +++ b/admin/app/components/solidus_admin/ui/toggletip/component.rb @@ -61,7 +61,7 @@ class SolidusAdmin::UI::Toggletip::Component < SolidusAdmin::BaseComponent # @param theme [Symbol] The theme of the toggletip. Defaults to `:light`. See # `THEMES` for available options. def initialize(text:, position: :down, theme: :light, **attributes) - @text = text || guide + @text = text @position = position @theme = theme @attributes = attributes From e113309006ddd32c1a0d4207884f2617720854b3 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 18 Sep 2023 17:44:16 +0200 Subject: [PATCH 2/4] Let the products controller render the component instead of the view This is a leftover from when we switched to rendering components directly. --- admin/app/controllers/solidus_admin/products_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/app/controllers/solidus_admin/products_controller.rb b/admin/app/controllers/solidus_admin/products_controller.rb index 3ceaf0640f7..d4a2d6550d8 100644 --- a/admin/app/controllers/solidus_admin/products_controller.rb +++ b/admin/app/controllers/solidus_admin/products_controller.rb @@ -26,7 +26,10 @@ def update redirect_to action: :show, status: :see_other else flash.now[:error] = @product.errors.full_messages.join(", ") - render action: :show, status: :unprocessable_entity + + respond_to do |format| + format.html { render component('products/show').new(product: @product), status: :unprocessable_entity } + end end end From ee2d347b374f8a03c0d341a55304cec4fc3f3c90 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Tue, 19 Sep 2023 12:00:11 +0200 Subject: [PATCH 3/4] Add a spec showing a validation error for admin/products --- admin/spec/features/product_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/spec/features/product_spec.rb b/admin/spec/features/product_spec.rb index 9948b41fb2b..1e65811b63b 100644 --- a/admin/spec/features/product_spec.rb +++ b/admin/spec/features/product_spec.rb @@ -40,6 +40,10 @@ within('header') { click_button "Save" } expect(page).to have_content("Just a product (updated)") + fill_in "Name", with: "" + within('header') { click_button "Save" } + + expect(page).to have_content("Name can't be blank") expect(page).to be_axe_clean end end From a16647bfcfbb8b38b07c5545222a11a9ea6359f9 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Tue, 19 Sep 2023 13:17:24 +0200 Subject: [PATCH 4/4] Remove the `aria-` prefix from the `role` attribute It was a typo. --- admin/app/components/solidus_admin/ui/table/component.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/app/components/solidus_admin/ui/table/component.html.erb b/admin/app/components/solidus_admin/ui/table/component.html.erb index c9fedbe8757..d391bab0648 100644 --- a/admin/app/components/solidus_admin/ui/table/component.html.erb +++ b/admin/app/components/solidus_admin/ui/table/component.html.erb @@ -87,7 +87,7 @@ -
-target="batchToolbar" aria-role="toolbar" aria-label="<%= t(".batch_actions") %>"> +
-target="batchToolbar" role="toolbar" aria-label="<%= t(".batch_actions") %>"> <%= form_tag '', id: batch_actions_form_id %> <% @batch_actions.each do |batch_action| %> <%= render_batch_action_button(batch_action) %>