Skip to content

Commit

Permalink
♿️(templates) fix organization glipmpse
Browse files Browse the repository at this point in the history
- Add a small fix to the title property the organization glimpse
- The value of title should be different from the organization card
- Change the tests to fit the new rule
  • Loading branch information
sandroscosta committed Oct 21, 2024
1 parent 9663661 commit b710862
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).

### Fixed

- Fix organization glimpse card title for accessibility purposes
- Fix logic to know if user is enrolled to a ongoing product
- Normalize credit card brand on CreditCardBrandLogo component

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div
class="organization-{{ organization_variant }}{% if organization_page.publisher_is_draft is True %} organization-{{ organization_variant }}--draft{% endif %}"
>
<a href="{{ organization_page.get_absolute_url }}" title="{{ organization_page.get_title }}" property="{{ organization_property|default:'author' }}" typeof="CollegeOrUniversity">
<a href="{{ organization_page.get_absolute_url }}" title="{% blocktranslate with title=organization_page.get_title %}Link to the organization page of {{ title }}{% endblocktranslate %}" property="{{ organization_property|default:'author' }}" typeof="CollegeOrUniversity">
<meta property="url" content="{{ SITE.web_url }}{{ organization_page.get_absolute_url }}" />
{% if organization_variant == "row" %}
<div class="organization-{{ organization_variant }}__logo">
Expand Down
8 changes: 5 additions & 3 deletions tests/apps/courses/test_cms_plugins_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def test_cms_plugins_organization_render_on_public_page(self):
self.assertIn(
(
'<div class="organization-glimpse"><a href="/en/public-title/" '
'title="public title" property="author" typeof="CollegeOrUniversity">'
'title="Link to the organization page of public title" '
'property="author" typeof="CollegeOrUniversity">'
),
htmlmin.minify(
response.content.decode("UTF-8"), remove_optional_attribute_quotes=False
Expand Down Expand Up @@ -129,7 +130,7 @@ def test_cms_plugins_organization_render_on_public_page(self):
url = page.get_absolute_url(language="fr")
response = self.client.get(url)
self.assertIn(
'<a href="/fr/titre-public/" title="titre public"',
'<a href="/fr/titre-public/" title="Link to the organization page of titre public"',
re.sub(" +", " ", str(response.content).replace("\\n", "")),
)
pattern = (
Expand Down Expand Up @@ -287,7 +288,8 @@ def test_cms_plugins_organization_fallback_when_never_published(self):
self.assertIn(
(
'<div class="organization-glimpse">'
'<a href="/en/organisation-publique/" title="organisation publique" '
'<a href="/en/organisation-publique/" '
'title="Link to the organization page of organisation publique" '
'property="author" typeof="CollegeOrUniversity">'
),
htmlmin.minify(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_cms_plugins_organizations_by_category_render_on_public_page(self):
# The organization's name should be present as a link to the cms page
# And CMS page title should be in title attribute of the link
self.assertIn(
'<a href="/en/public-title/" title="public title"',
'<a href="/en/public-title/" title="Link to the organization page of public title"',
re.sub(" +", " ", str(response.content).replace("\\n", "")),
)

Expand Down Expand Up @@ -134,7 +134,7 @@ def test_cms_plugins_organizations_by_category_render_on_public_page(self):
url = page.get_absolute_url(language="fr")
response = self.client.get(url)
self.assertIn(
'<a href="/fr/titre-public/" title="titre public"',
'<a href="/fr/titre-public/" title="Link to the organization page of titre public"',
re.sub(" +", " ", str(response.content).replace("\\n", "")),
)
pattern = (
Expand Down
4 changes: 2 additions & 2 deletions tests/apps/courses/test_templates_person_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_templates_person_detail_cms_draft_content(self):
self.assertIn(
# pylint: disable=consider-using-f-string
'<div class="organization-glimpse">'
'<a href="{:s}" title="{:s}" '
'<a href="{:s}" title="Link to the organization page of {:s}" '
'property="author" typeof="CollegeOrUniversity">'.format(
published_organization.extended_object.get_absolute_url(),
published_organization.extended_object.get_title(),
Expand All @@ -356,7 +356,7 @@ def test_templates_person_detail_cms_draft_content(self):
# The not published organization should not be on the page
self.assertIn(
# pylint: disable=consider-using-f-string
'<a href="{:s}" title="{:s}" '
'<a href="{:s}" title="Link to the organization page of {:s}" '
'property="author" typeof="CollegeOrUniversity">'.format(
not_published_organization.extended_object.get_absolute_url(),
not_published_organization.extended_object.get_title(),
Expand Down

0 comments on commit b710862

Please sign in to comment.