Skip to content

Commit

Permalink
Remove inaccurate comment
Browse files Browse the repository at this point in the history
- As far as I can tell, the .html_safe does not impact display, but it was a hypothesis I tested.
  • Loading branch information
maxkadel committed Jun 29, 2023
1 parent 2bbd706 commit a052462
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/helpers/requests/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def pick_up_choices(requestable, default_pick_ups, collapse = false)
end

def preferred_request_content_tag(requestable, default_pick_ups)
(show_pick_up_service_options(requestable, nil) || "") +
(show_pick_up_service_options(requestable, nil) || "".html_safe) +
content_tag(:div, id: "fields-print__#{requestable.preferred_request_id}_card", class: "card card-body bg-light") do
locs = pick_up_locations(requestable, default_pick_ups)
# temporary changes issue 438
Expand Down Expand Up @@ -378,7 +378,6 @@ def single_pickup(is_charged, name, id, location)
else
''
end
# if we remove the `.json` it fixes our feature test, but breaks our other tests
hidden = hidden_field_tag name.to_s, "", value: { 'pick_up' => location[:gfa_pickup], 'pick_up_location_code' => location[:pick_up_location_code] }.to_json, class: 'single-pick-up-hidden', id: id
label = label_tag id, "Pick-up location: #{location[:label]}", class: 'single-pick-up', style: style.to_s
hidden + label
Expand Down
28 changes: 28 additions & 0 deletions spec/helpers/requests/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,34 @@
let(:default_pick_ups) { [{ label: 'place', gfa_pickup: 'xx', staff_only: false, pick_up_location_code: 'firestone' }] }
let(:card_div) { '<div id="fields-print__abc123_card" class="card card-body bg-light">' }

context "Plasma Physics from Lewis" do
let(:locations) do
[{ "label" => "Lewis Library", "address" => "Washington Road and Ivy Lane Princeton, NJ 08544",
"phone_number" => "609-258-6004", "contact_email" => "lewislib@princeton.edu",
"gfa_pickup" => "PN", "staff_only" => false, "pickup_location" => true,
"digital_location" => true, "library" => { "label" => "Lewis Library", "code" => "lewis",
"order" => 0 }, "pick_up_location_code" => "lewis" }]
end
let(:location) do
{ "label" => "New Book Shelf", "code" => "plasma$nb", "aeon_location" => false,
"recap_electronic_delivery_location" => false, "open" => true, "requestable" => true,
"always_requestable" => false, "circulates" => true, "remote_storage" => "",
"fulfillment_unit" => "Limited",
"library" => { "label" => "Harold P. Furth Plasma Physics Library",
"code" => "plasma", "order" => 0 },
"holding_library" => nil,
"delivery_locations" => locations }
end
let(:stubbed_questions) do
{ no_services?: true, preferred_request_id: '22693661550006421',
pending?: false, pick_up_locations: locations, charged?: false,
location:, ill_eligible?: false, on_shelf?: false, recap?: false,
annex?: false }
end
it 'shows the default pick-up location' do
expect(helper.preferred_request_content_tag(requestable, default_pick_ups)).to be_html_safe
end
end
context "no services" do
let(:stubbed_questions) { { no_services?: true, preferred_request_id: 'abc123', pending?: false, recap?: false, recap_pf?: false, annex?: false, pick_up_locations: nil, charged?: false, on_shelf?: false, location: { "library" => default_pick_ups[0] }, ill_eligible?: false } }
it 'shows default pick-up location' do
Expand Down

0 comments on commit a052462

Please sign in to comment.