Browse Source

Add autocomplete placeholder (#2300)

pull/2278/head^2
kosiakkatrina 10 months ago committed by GitHub
parent
commit
7faf3056be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/frontend/controllers/accessible_autocomplete_controller.js
  2. 4
      spec/features/form/accessible_autocomplete_spec.rb

1
app/frontend/controllers/accessible_autocomplete_controller.js

@ -22,6 +22,7 @@ export default class extends Controller {
} }
}, },
autoselect: true, autoselect: true,
placeholder: 'Start typing to search',
templates: { suggestion: (value) => suggestion(value, options) }, templates: { suggestion: (value) => suggestion(value, options) },
name: rawFieldName, name: rawFieldName,
onConfirm: (val) => { onConfirm: (val) => {

4
spec/features/form/accessible_autocomplete_spec.rb

@ -63,6 +63,10 @@ RSpec.describe "Accessible Autocomplete" do
page.go_back page.go_back
expect(page).to have_selector("input", class: "autocomplete__input", count: 1) expect(page).to have_selector("input", class: "autocomplete__input", count: 1)
end end
it "displays the placeholder text", js: true do
expect(find("#lettings-log-prevloc-field")["placeholder"]).to eq("Start typing to search")
end
end end
context "when searching schemes" do context "when searching schemes" do

Loading…
Cancel
Save