mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Notify when stock limit reached on cart rather than silently capping
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
-# "price-breakdown-placement" => "left",
|
||||
-# "price-breakdown-animation" => true}
|
||||
%td.text-center.cart-item-quantity{"data-hook" => "cart_item_quantity"}
|
||||
= item_form.number_field :quantity, :min => 0, :max => variant.on_hand, :class => "line_item_quantity", :size => 5
|
||||
= item_form.number_field :quantity, :min => 0, "ofn-on-hand" => variant.on_hand, :class => "line_item_quantity", :size => 5
|
||||
%td.cart-item-total.text-right{"data-hook" => "cart_item_total"}
|
||||
= line_item.display_amount_with_adjustments.to_html unless line_item.quantity.nil?
|
||||
|
||||
|
||||
@@ -32,12 +32,20 @@ feature "full-page cart", js: true do
|
||||
describe "updating quantities with insufficient stock available" do
|
||||
let(:li) { order.line_items(true).last }
|
||||
|
||||
use_short_wait 10
|
||||
|
||||
before do
|
||||
variant.update_attributes! on_hand: 2
|
||||
end
|
||||
|
||||
it "prevents me from entering an invalid value" do
|
||||
visit spree.cart_path
|
||||
|
||||
accept_alert 'Insufficient stock available, only 2 remaining' do
|
||||
fill_in "order_line_items_attributes_0_quantity", with: '4'
|
||||
end
|
||||
|
||||
page.should have_field "order_line_items_attributes_0_quantity", with: '2'
|
||||
end
|
||||
|
||||
it "shows the quantities saved, not those submitted" do
|
||||
fill_in "order_line_items_attributes_0_quantity", with: '4'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user