Highlight voucher on order summary step

This commit is contained in:
Gaetan Craig-Riou
2023-03-21 11:52:50 +11:00
committed by Maikel Linke
parent 856386fcb0
commit 74a8730f04
3 changed files with 27 additions and 2 deletions

View File

@@ -85,8 +85,12 @@
- checkout_adjustments_for(@order, exclude: [:line_item]).reverse_each do |adjustment|
.summary-right-line
.summary-right-line-label= adjustment.label
.summary-right-line-value= adjustment.display_amount.to_html
-if adjustment.originator_type == 'Voucher'
.summary-right-line-label.voucher= adjustment.label
.summary-right-line-value.voucher= adjustment.display_amount.to_html
-else
.summary-right-line-label= adjustment.label
.summary-right-line-value= adjustment.display_amount.to_html
- if @order.total_tax > 0
.summary-right-line

View File

@@ -332,6 +332,10 @@
padding-left: 20px;
padding-right: 20px;
border-right: 1px solid #DDD;
.voucher {
color: $teal-500
}
}
}
}

View File

@@ -1084,6 +1084,23 @@ describe "As a consumer, I want to checkout my order" do
}.to change { order.reload.state }.from("confirmation").to("address")
end
end
describe "vouchers" do
let(:voucher) { Voucher.create(code: 'some_code', enterprise: distributor) }
before do
# Add voucher to the order
voucher.create_adjustment(voucher.code, order)
visit checkout_step_path(:summary)
end
it "shows the applied voucher" do
within ".summary-right" do
expect(page).to have_content "some_code"
end
end
end
end
context "with previous open orders" do