Browse Source

feat: test incomplete count too

pull/1455/head
natdeanlewissoftwire 3 years ago
parent
commit
e928ebddba
  1. 3
      spec/features/form/accessible_autocomplete_spec.rb

3
spec/features/form/accessible_autocomplete_spec.rb

@ -75,6 +75,7 @@ RSpec.describe "Accessible Autocomplete" do
before do before do
FactoryBot.create(:location, scheme:, postcode: "W6 0ST", startdate: Time.zone.local(2022, 1, 1)) FactoryBot.create(:location, scheme:, postcode: "W6 0ST", startdate: Time.zone.local(2022, 1, 1))
FactoryBot.create(:location, scheme:, postcode: "SE6 1LB", startdate: Time.zone.local(2022, 1, 1)) FactoryBot.create(:location, scheme:, postcode: "SE6 1LB", startdate: Time.zone.local(2022, 1, 1))
FactoryBot.create(:location, scheme:, postcode: nil, startdate: Time.zone.local(2022, 1, 1), confirmed: false)
lettings_log.update!(needstype: 2) lettings_log.update!(needstype: 2)
visit("/lettings-logs/#{lettings_log.id}/scheme") visit("/lettings-logs/#{lettings_log.id}/scheme")
end end
@ -87,7 +88,7 @@ RSpec.describe "Accessible Autocomplete" do
it "displays appended text next to the options", js: true do it "displays appended text next to the options", js: true do
find("#lettings-log-scheme-id-field").click.native.send_keys("w", "6", :down, :enter) find("#lettings-log-scheme-id-field").click.native.send_keys("w", "6", :down, :enter)
expect(find(".autocomplete__option", visible: :hidden, text: scheme.service_name)).to be_present expect(find(".autocomplete__option", visible: :hidden, text: scheme.service_name)).to be_present
expect(find("span", visible: :hidden, text: "2 completed locations, 0 incomplete locations")).to be_present expect(find("span", visible: :hidden, text: "2 completed locations, 1 incomplete location")).to be_present
end end
it "displays hint text under the options", js: true do it "displays hint text under the options", js: true do

Loading…
Cancel
Save