You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1018 B
36 lines
1018 B
3 years ago
|
require "rails_helper"
|
||
|
require_relative "helpers"
|
||
|
require_relative "../../request_helper"
|
||
|
|
||
|
RSpec.describe "Accessible Automcomplete" do
|
||
|
include Helpers
|
||
|
let(:user) { FactoryBot.create(:user) }
|
||
|
let(:case_log) do
|
||
|
FactoryBot.create(
|
||
|
:case_log,
|
||
|
:in_progress,
|
||
|
owning_organisation: user.organisation,
|
||
|
managing_organisation: user.organisation,
|
||
|
)
|
||
|
end
|
||
|
|
||
|
before do
|
||
|
RequestHelper.stub_http_requests
|
||
|
sign_in user
|
||
|
end
|
||
|
|
||
|
it "does not show when js is not enabled" do
|
||
|
visit("/logs/#{case_log.id}/rent")
|
||
|
expect(page).to have_selector("#tcharge_div", visible: false)
|
||
|
end
|
||
|
|
||
|
it "does show when js is enabled and calculates the total", js: true do
|
||
|
visit("/logs/#{case_log.id}/rent")
|
||
|
expect(page).to have_selector("#tcharge_div", visible: true)
|
||
|
fill_in("case-log-brent-field", with: 5)
|
||
|
expect(find("#case-log-tcharge-field").value).to eq("5")
|
||
|
fill_in("case-log-pscharge-field", with: 3)
|
||
|
expect(find("#case-log-tcharge-field").value).to eq("8")
|
||
|
end
|
||
|
end
|