diff --git a/app/frontend/controllers/accessible_autocomplete_controller.js b/app/frontend/controllers/accessible_autocomplete_controller.js index 812cd37d3..242c0c3e4 100644 --- a/app/frontend/controllers/accessible_autocomplete_controller.js +++ b/app/frontend/controllers/accessible_autocomplete_controller.js @@ -13,7 +13,7 @@ export default class extends Controller { const rawFieldName = matches ? `${matches[1]}[${matches[2]}_raw]` : '' accessibleAutocomplete.enhanceSelectElement({ - defaultValue: '', + defaultValue: options[0].name, selectElement: selectEl, minLength: 1, source: (query, populateResults) => { diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 61f3ce024..68caaec77 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -630,7 +630,7 @@ RSpec.describe "User Features" do it "clears the previously selected organisation value" do visit("/logs") choose("organisation-select-specific-org-field", allow_label_click: true) - expect(page).to have_field("organisation-field", with: "") + expect(page).to have_field("organisation-field", with: "Select an option") find("#organisation-field").click.native.send_keys("F", "i", "l", "t", :down, :enter) click_button("Apply filters") expect(page).to have_current_path("/logs?%5Byears%5D%5B%5D=&%5Bstatus%5D%5B%5D=&user=all&organisation_select=specific_org&organisation=#{organisation.id}")