From 7faf3056bedc92e5965e0a297de51428b70ae8fa Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Wed, 13 Mar 2024 11:20:55 +0000 Subject: [PATCH] Add autocomplete placeholder (#2300) --- .../controllers/accessible_autocomplete_controller.js | 1 + spec/features/form/accessible_autocomplete_spec.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/frontend/controllers/accessible_autocomplete_controller.js b/app/frontend/controllers/accessible_autocomplete_controller.js index b510a6b02..f3a6ca1d8 100644 --- a/app/frontend/controllers/accessible_autocomplete_controller.js +++ b/app/frontend/controllers/accessible_autocomplete_controller.js @@ -22,6 +22,7 @@ export default class extends Controller { } }, autoselect: true, + placeholder: 'Start typing to search', templates: { suggestion: (value) => suggestion(value, options) }, name: rawFieldName, onConfirm: (val) => { diff --git a/spec/features/form/accessible_autocomplete_spec.rb b/spec/features/form/accessible_autocomplete_spec.rb index 373d0232d..e525da46f 100644 --- a/spec/features/form/accessible_autocomplete_spec.rb +++ b/spec/features/form/accessible_autocomplete_spec.rb @@ -63,6 +63,10 @@ RSpec.describe "Accessible Autocomplete" do page.go_back expect(page).to have_selector("input", class: "autocomplete__input", count: 1) end + + it "displays the placeholder text", js: true do + expect(find("#lettings-log-prevloc-field")["placeholder"]).to eq("Start typing to search") + end end context "when searching schemes" do