Same display css rules for price of payment and shipping method

+ update spec since parenthesis are added by css
This commit is contained in:
Jean-Baptiste Bellet
2022-12-13 15:39:11 +01:00
parent a6856f3d21
commit f1bb4fdf38
4 changed files with 16 additions and 4 deletions

View File

@@ -89,8 +89,7 @@
"data-action": "toggle#toggle shippingmethod#selectShippingMethod",
"data-toggle-show": shipping_method.require_ship_address
= shipping_method_form.label shipping_method.id, shipping_method.name, {for: "shipping_method_" + shipping_method.id.to_s }
%em.light
= payment_or_shipping_price(shipping_method, @order)
%em= payment_or_shipping_price(shipping_method, @order)
- display_ship_address = display_ship_address || (ship_method_is_selected && shipping_method.require_ship_address)
%div.checkout-input{"data-shippingmethod-target": "shippingMethodDescription", "data-shippingmethodid": shipping_method.id , style: "display: #{ship_method_is_selected ? 'block' : 'none'}" }
#distributor_address.panel

View File

@@ -14,7 +14,8 @@
"data-action": "paymentmethod#selectPaymentMethod",
"data-paymentmethod-id": "paymentmethod#{payment_method.id}",
"data-paymentmethod-target": "input"
= f.label :payment_method_id, "#{payment_method.name} (#{payment_or_shipping_price(payment_method, @order)})", for: "payment_method_#{payment_method.id}"
= f.label :payment_method_id, "#{payment_method.name}", for: "payment_method_#{payment_method.id}"
%em=payment_or_shipping_price(payment_method, @order)
= f.error_message_on :payment_method, standalone: true

View File

@@ -156,6 +156,18 @@
label {
margin-top: 0.3rem;
& + em {
margin-left: -0.5rem;
font-size: 14px; // same as label
font-weight: bold;
// Add opening and closing parentheses
&:before {
content: "(";
}
&:after {
content: ")";
}
}
}
}
}

View File

@@ -577,7 +577,7 @@ describe "As a consumer, I want to checkout my order", js: true do
expect(page).to have_checked_field "payment_method_#{payment_with_fee.id}"
end
it "displays the transaction fee" do
expect(page).to have_content("#{payment_with_fee.name} " + "(#{with_currency(1.23)})")
expect(page).to have_content("#{payment_with_fee.name} " + with_currency(1.23).to_s)
end
end