Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use <address> instead of <div> in {% format_address %}, test for address-inline class

Rafał Pitoń23bb084f2c3d
diff --git a/templates/checkout/snippets/addresses_form_panel.html b/templates/checkout/snippets/addresses_form_panel.html
index a70d29fc3c..18c1b2640e 100644
--- a/templates/checkout/snippets/addresses_form_panel.html
+++ b/templates/checkout/snippets/addresses_form_panel.html
@@ -6,8 +6,10 @@
value="{{ radio_value }}"
id="address_{{ radio_value }}"
{% if radio_value == value %}checked{% endif %}>
- {% if address %}
- {% format_address address %}
+ {% if address %}
+ <div class="address-details">
+ {% format_address address %}
+ </div>
{% else %}
{{ label }}
{% endif %}
diff --git a/templates/formatted_address.html b/templates/formatted_address.html
index 7325a303cf..bf5abfb74a 100644
--- a/templates/formatted_address.html
+++ b/templates/formatted_address.html
@@ -1,3 +1,3 @@
-<div class="address-details{% if inline %} address-inline{% endif %}">
+<address class="address-formatted{% if inline %} address-inline{% endif %}">
{% if inline %}{{ address_lines|join:', ' }}{% else %}{{ address_lines|join:'<br>' }}{% endif %}
-</div>
\ No newline at end of file
+</address>
\ No newline at end of file
diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.html
index ccbbf6d2b9..163505ab57 100644
--- a/templates/order/_ordered_items_table.html
+++ b/templates/order/_ordered_items_table.html
@@ -14,7 +14,7 @@
<h3>
{% trans "Shipping address" context "Order details address title" %}
</h3>
- {% format_address order.shipping_address %}
+ {% format_address order.shipping_address %}
</div>
{% endif %}
<div class="col-6">
diff --git a/tests/test_userprofile.py b/tests/test_userprofile.py
index aacd544d54..d9daff7eb0 100644
--- a/tests/test_userprofile.py
+++ b/tests/test_userprofile.py
@@ -145,6 +145,7 @@ def test_format_address(billing_address):
'{% format_address address %}')
rendered_html = tpl.render(context)
assert address_html in rendered_html
+ assert 'address-inline' not in rendered_html
assert str(billing_address.phone) in rendered_html
@@ -158,4 +159,5 @@ def test_format_address_all_options(billing_address):
'{% format_address address include_phone=False inline=True latin=True %}')
rendered_html = tpl.render(context)
assert address_html in rendered_html
+ assert 'address-inline' in rendered_html
assert str(billing_address.phone) not in rendered_html