|
|
@ -8,8 +8,8 @@ RSpec.describe "Accessible Automcomplete" do |
|
|
|
FactoryBot.create( |
|
|
|
FactoryBot.create( |
|
|
|
:case_log, |
|
|
|
:case_log, |
|
|
|
:in_progress, |
|
|
|
:in_progress, |
|
|
|
la_known: 1, |
|
|
|
previous_la_known: 1, |
|
|
|
la: "E09000033", |
|
|
|
prevloc: "E09000033", |
|
|
|
is_la_inferred: false, |
|
|
|
is_la_inferred: false, |
|
|
|
owning_organisation: user.organisation, |
|
|
|
owning_organisation: user.organisation, |
|
|
|
managing_organisation: user.organisation, |
|
|
|
managing_organisation: user.organisation, |
|
|
@ -22,13 +22,13 @@ RSpec.describe "Accessible Automcomplete" do |
|
|
|
|
|
|
|
|
|
|
|
it "allows type ahead filtering", js: true do |
|
|
|
it "allows type ahead filtering", js: true do |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
find("#case-log-la-field").click.native.send_keys("T", "h", "a", "n", :down, :enter) |
|
|
|
find("#case-log-prevloc-field").click.native.send_keys("T", "h", "a", "n", :down, :enter) |
|
|
|
expect(find("#case-log-la-field").value).to eq("Thanet") |
|
|
|
expect(find("#case-log-prevloc-field").value).to eq("Thanet") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "maintains enhancement state across back navigation", js: true do |
|
|
|
it "maintains enhancement state across back navigation", js: true do |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
find("#case-log-la-field").click.native.send_keys("T", "h", "a", "n", :down, :enter) |
|
|
|
find("#case-log-prevloc-field").click.native.send_keys("T", "h", "a", "n", :down, :enter) |
|
|
|
click_button("Save and continue") |
|
|
|
click_button("Save and continue") |
|
|
|
click_link(text: "Back") |
|
|
|
click_link(text: "Back") |
|
|
|
expect(page).to have_selector("input", class: "autocomplete__input", count: 1) |
|
|
|
expect(page).to have_selector("input", class: "autocomplete__input", count: 1) |
|
|
@ -36,12 +36,12 @@ RSpec.describe "Accessible Automcomplete" do |
|
|
|
|
|
|
|
|
|
|
|
it "has a disabled null option" do |
|
|
|
it "has a disabled null option" do |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
expect(page).to have_select("case-log-la-field", disabled_options: ["Select an option"]) |
|
|
|
expect(page).to have_select("case-log-prevloc-field", disabled_options: ["Select an option"]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has the correct option selected if one has been saved" do |
|
|
|
it "has the correct option selected if one has been saved" do |
|
|
|
case_log.update!(postcode_known: 0, la_known: 1, la: "E07000178") |
|
|
|
case_log.update!(postcode_known: 0, previous_la_known: 1, prevloc: "E07000178") |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
visit("/logs/#{case_log.id}/accessible-select") |
|
|
|
expect(page).to have_select("case-log-la-field", selected: %w[Oxford]) |
|
|
|
expect(page).to have_select("case-log-prevloc-field", selected: %w[Oxford]) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|