diff --git a/app/views/alchemy/ingredients/_headline_editor.html.erb b/app/views/alchemy/ingredients/_headline_editor.html.erb index b13cec0900..15b53627d8 100644 --- a/app/views/alchemy/ingredients/_headline_editor.html.erb +++ b/app/views/alchemy/ingredients/_headline_editor.html.erb @@ -12,20 +12,25 @@ <%= render "alchemy/ingredients/shared/anchor", ingredient_editor: headline_editor %> <% end %> - <% if has_level_select %> -
"> +
"> + <%= f.select :level, options_for_select(headline_editor.level_options, headline_editor.level), {}, - { class: "custom-select", title: f.object.class.human_attribute_name(:level) } %> -
- <% end %> + { + class: "custom-select", + disabled: !has_level_select + } %> + +
<% if has_size_select %>
- <%= f.select :size, options_for_select(headline_editor.size_options, headline_editor.size), - {}, - { class: "custom-select", title: f.object.class.human_attribute_name(:size) } %> + + <%= f.select :size, options_for_select(headline_editor.size_options, headline_editor.size), + {}, + { class: "custom-select" } %> +
<% end %> <% end %> diff --git a/spec/views/alchemy/ingredients/headline_editor_spec.rb b/spec/views/alchemy/ingredients/headline_editor_spec.rb index 7cb3cdba19..9cd071f5dc 100644 --- a/spec/views/alchemy/ingredients/headline_editor_spec.rb +++ b/spec/views/alchemy/ingredients/headline_editor_spec.rb @@ -38,13 +38,17 @@ is_expected.to have_selector("select[name='element[ingredients_attributes][0][level]']") end + it "renders a tooltip" do + is_expected.to have_selector("sl-tooltip[content='Level']") + end + context "when only one level is given" do let(:settings) do {levels: [1]} end - it "does not render a level select" do - is_expected.to_not have_selector("select[name='element[ingredients_attributes][0][level]']") + it "renders a disabled level select" do + is_expected.to have_selector("select[disabled][name='element[ingredients_attributes][0][level]']") end end @@ -60,6 +64,10 @@ it "renders a size select" do is_expected.to have_selector("select[name='element[ingredients_attributes][0][size]']") end + + it "renders a tooltip" do + is_expected.to have_selector("sl-tooltip[content='Size']") + end end context "with settings anchor set to true" do