Show fee breakdown in line items panel if present

This commit is contained in:
Rob Harrington
2018-05-30 12:48:25 +10:00
committed by Maikel Linke
parent d726b0a851
commit fb93351386
2 changed files with 29 additions and 1 deletions

View File

@@ -29,7 +29,16 @@
= t(:subtotal)
\:
%td.total.align-center
%span {{ subscription.estimatedSubtotal() | currency }}
%span#order_subtotal {{ subscription.estimatedSubtotal() | currency }}
%td.actions
%tbody#fees.no-border-top{ ng: { show: "subscription.estimatedFees() > 0" } }
%tr#fees-row
%td{:colspan => "3"}
%b
= t(:fees)
\:
%td.total.align-center
%span#order_fees {{ subscription.estimatedFees() | currency }}
%td.actions
%tbody#order-total.grand-total.no-border-top{"data-hook" => "admin_order_form_total"}
%tr

View File

@@ -17,6 +17,13 @@ feature 'Subscriptions' do
let!(:subscription2) { create(:subscription, shop: shop2, with_items: true, with_proxy_orders: true) }
let!(:subscription_unmanaged) { create(:subscription, shop: shop_unmanaged, with_items: true, with_proxy_orders: true) }
before do
subscription.update_attributes(shipping_fee_estimate: 3.5)
subscription.subscription_line_items.each do |sli|
sli.update_attributes(price_estimate: 5)
end
end
it "passes the smoke test" do
visit spree.admin_path
click_link 'Orders'
@@ -60,6 +67,18 @@ feature 'Subscriptions' do
expect(page).to_not have_selector "th.customer"
expect(page).to_not have_content subscription.customer.email
# Viewing Products
within "tr#so_#{subscription.id}" do
expect(page).to have_selector "td.items.panel-toggle", text: 3
page.find("td.items.panel-toggle").trigger('click')
end
within "#subscription-line-items" do
expect(page).to have_selector "span#order_subtotal", text: "$15.00" # 3 x $5 items
expect(page).to have_selector "span#order_fees", text: "$3.50" # $3.5 shipping
expect(page).to have_selector "span#order_form_total", text: "$18.50" # 3 x $5 items + $3.5 shipping
end
# Viewing Orders
within "tr#so_#{subscription.id}" do
expect(page).to have_selector "td.orders.panel-toggle", text: 1