mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #13061 from kernal053/add-voucher-label-to-edit-cart-page
Add 'Voucher:' before voucher code on edit cart page
This commit is contained in:
@@ -34,7 +34,11 @@
|
||||
- checkout_adjustments_for(@order, exclude: [:line_item]).reverse_each do |adjustment|
|
||||
%tr.order-adjustment
|
||||
%td.text-right{:colspan => "3"}
|
||||
= adjustment.label
|
||||
- if adjustment.originator_type == "Voucher"
|
||||
= "#{t(:voucher)}:"
|
||||
= adjustment.label
|
||||
- else
|
||||
= adjustment.label
|
||||
%td.text-right.total
|
||||
%span= adjustment.display_amount.to_html
|
||||
%td
|
||||
|
||||
@@ -31,4 +31,30 @@ RSpec.describe "spree/orders/edit.html.haml" do
|
||||
expect(rendered).to have_selector(".unit-price")
|
||||
end
|
||||
end
|
||||
|
||||
describe "display adjustments" do
|
||||
let(:voucher) { create(:voucher, enterprise: order.distributor) }
|
||||
|
||||
before do
|
||||
voucher.create_adjustment(voucher.code, order)
|
||||
OrderManagement::Order::Updater.new(order).update_voucher
|
||||
render
|
||||
end
|
||||
|
||||
it "includes Voucher text with label" do
|
||||
expect(rendered).to have_content("Voucher:\n#{voucher.code}")
|
||||
end
|
||||
|
||||
# Shipping fee is derived from 'completed_order_with_fees' factory.
|
||||
# It applies when using shipping method such as Home Delivery.
|
||||
it "includes Shipping label" do
|
||||
expect(rendered).to have_content("Shipping")
|
||||
end
|
||||
|
||||
# Transaction fee is derived from 'completed_order_with_fees' factory.
|
||||
# It applies when using payment methods such as Check & Stripe.
|
||||
it "includes Transaction fee label" do
|
||||
expect(rendered).to have_content("Transaction fee")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user