From 8130e4fbc81482e0c2f122021b95b523868111b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 12 Oct 2024 19:34:01 +0200 Subject: [PATCH] Add an aria-label to the "choose your booth" select We're using the `aria-label` attribute instead of a label because this is a page where only one field is rendered and the text of the label is the same as the text of the

tag. We're using `aria-label` instead of `aria-labelledby` because the former is supported by Capybara. --- app/views/officing/booth/new.html.erb | 4 ++-- spec/system/officing/booth_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/officing/booth/new.html.erb b/app/views/officing/booth/new.html.erb index afb1b090a..a520a234f 100644 --- a/app/views/officing/booth/new.html.erb +++ b/app/views/officing/booth/new.html.erb @@ -12,8 +12,8 @@
<%= f.select :id, @booths.map { |booth| [booth.location, booth.id] }, - selected: @booths.first, - label: false %> + { selected: @booths.first, label: false }, + { "aria-label": t("officing.booth.new.title") } %> <%= f.submit(t("devise_views.sessions.new.submit"), class: "button expanded") %>
diff --git a/spec/system/officing/booth_spec.rb b/spec/system/officing/booth_spec.rb index 2f86cbdd0..cf5b66aaa 100644 --- a/spec/system/officing/booth_spec.rb +++ b/spec/system/officing/booth_spec.rb @@ -47,7 +47,7 @@ describe "Booth", :with_frozen_time do expect(page).to have_content "Choose your booth" - select booth2.location, from: "booth_id" + select booth2.location, from: "Choose your booth" click_button "Enter" within("#officing-booth") do @@ -72,6 +72,6 @@ describe "Booth", :with_frozen_time do expect(page).to have_content "Choose your booth" - expect(page).to have_select("booth_id", options: [booth1.location, booth2.location]) + expect(page).to have_select "Choose your booth", options: [booth1.location, booth2.location] end end