From 1281ae795899cafe39de9db6823b1da3c23aaa65 Mon Sep 17 00:00:00 2001 From: Nelson Saloj <110138549+nsaloj@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:24:22 -0600 Subject: [PATCH] Fix humanization for add nested element button Converting `nestable_element` to a symbol allows us to humanize the nestable element name. --- .../alchemy/admin/elements/_add_nested_element_form.html.erb | 4 ++-- spec/features/admin/edit_elements_feature_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb b/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb index e74c3f713f..4b355ba722 100644 --- a/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb +++ b/app/views/alchemy/admin/elements/_add_nested_element_form.html.erb @@ -9,11 +9,11 @@ <%= f.hidden_field :page_version_id, value: element.page_version_id %> <%= f.hidden_field :parent_element_id, value: element.id %> <% end %> <% else %> - <%= link_to_dialog (nestable_element ? Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element, scope: 'element_names')) : Alchemy.t("New Element")), + <%= link_to_dialog (nestable_element ? Alchemy.t(:add_nested_element, name: Alchemy.t(nestable_element.to_sym, scope: 'element_names')) : Alchemy.t("New Element")), alchemy.new_admin_element_path( parent_element_id: element.id, page_version_id: element.page_version_id diff --git a/spec/features/admin/edit_elements_feature_spec.rb b/spec/features/admin/edit_elements_feature_spec.rb index 55be6eed1e..e4c6028c35 100644 --- a/spec/features/admin/edit_elements_feature_spec.rb +++ b/spec/features/admin/edit_elements_feature_spec.rb @@ -65,7 +65,7 @@ scenario "the add button opens add element form with the clipboard tab" do visit alchemy.admin_elements_path(page_version_id: element.page_version_id) button = page.find(".add-nestable-element-button") - expect(button).to have_content "Add slide" + expect(button).to have_content "Add Slide" button.click expect(page).to have_select("Element") expect(page).to have_css("[panel='paste_element_tab']") @@ -76,7 +76,7 @@ scenario "the add element button immediately creates the nested element." do visit alchemy.admin_elements_path(page_version_id: element.page_version_id) button = page.find("button.add-nestable-element-button") - expect(button).to have_content "Add slide" + expect(button).to have_content "Add Slide" button.click expect(page).to have_selector(".element-editor[data-element-name='slide']") end