Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/line_items/_line_item_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
collection: @item_labels_with_quantities || @items, prompt: "Choose an item",
include_blank: "",
label: false,
input_html: { class: "my-0 line_item_name", "data-controller": "select2" } %>
input_html: { class: "my-0 line_item_name", "data-controller": "select2", "data-select2-config-value": '{"width": "100%"}' } %>
<% if requested.present? %>
<%= field.input :item_id, as: :hidden %>
<% end %>
Expand Down
20 changes: 19 additions & 1 deletion spec/system/distribution_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,26 @@
expect(@request.distribution_id).to eq @distribution.id
expect(@request).to be_status_fulfilled
end
end

it "keeps the item dropdown within the form width when the window is narrowed" do
item_id = storage_location.items.first.id
request_items = [{ "item_id" => item_id, "quantity" => 10 }]
@request = create(:request, organization:, request_items:, partner:)
create(:item_request, request: @request, item_id:, quantity: 10)

visit request_path(id: @request.id)
click_on "Fulfill request"

expect(page).to have_css(".li-name .select2-container")

current_window.resize_to(600, 800)

dropdown_width = page.evaluate_script("document.querySelector('.li-name .select2-container').offsetWidth")
column_width = page.evaluate_script("document.querySelector('.li-name').offsetWidth")

expect(dropdown_width).to be <= column_width
end
end
context "via barcode entry" do
let(:existing_barcode) { create(:barcode_item, quantity: 50) }
let(:item_with_barcode) { existing_barcode.item }
Expand Down