Skip to content

Commit

Permalink
text fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephaniehobson committed Sep 11, 2024
1 parent 968a137 commit 12793a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions bedrock/contentful/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ def render(self, node):
if url.netloc != "www.mozilla.org":
# add security measures
rel = ' rel="external noopener"'
# add analytics
cta_text = _make_plain_text(node)
data_cta = f' data-cta-text="{cta_text}"'

# add analytics
cta_text = _make_plain_text(node)
data_cta = f' data-cta-text="{cta_text}"'

return f'<a href="{urlunparse(url)}{ref}"{data_cta}{rel}>{self._render_content(node)}</a>'

Expand Down
2 changes: 1 addition & 1 deletion bedrock/newsletter/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_shows_form_single(self):
doc = pq(resp.content)
self.assertTrue(doc("#newsletter-form"))
self.assertTrue(doc('input[value="mozilla-foundation"]'))
self.assertEqual(doc("#newsletter-submit")[0].attrib["data-cta-type"], "Newsletter-mozilla-foundation")
self.assertEqual(doc("#newsletter-submit")[0].attrib["data-cta-text"], "Newsletter Sign Up")

@patch("bedrock.newsletter.views.basket")
def test_returns_success(self, basket_mock):
Expand Down
6 changes: 3 additions & 3 deletions bedrock/products/tests/test_helper_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ def test_vpn_product_referral_link(self):
expected = (
'<a href="/en-US/products/vpn/#pricing" class="mzp-c-button js-fxa-product-referral-link '
'mzp-t-product mzp-t-secondary mzp-t-md" data-referral-id="navigation" '
'data-cta-text="Get Mozilla VPN" >Get Mozilla VPN</a>'
'data-cta-text="Get Mozilla VPN">Get Mozilla VPN</a>'
)
self.assertEqual(markup, expected)

Expand All @@ -1682,7 +1682,7 @@ def test_vpn_product_referral_link_pricing_page(self):
expected = (
'<a href="/en-US/products/vpn/pricing/" class="mzp-c-button js-fxa-product-referral-link '
'mzp-t-product mzp-t-secondary mzp-t-md" data-referral-id="navigation" '
'data-cta-text="Get Mozilla VPN" >Get Mozilla VPN</a>'
'data-cta-text="Get Mozilla VPN" data-cta-type="vpn">Get Mozilla VPN</a>'
)
self.assertEqual(markup, expected)

Expand All @@ -1699,6 +1699,6 @@ def test_vpn_product_referral_link_optional_params(self):
expected = (
'<a href="/en-US/products/vpn/pricing/?coupon=cyber20" class="mzp-c-button js-fxa-product-referral-link '
'mzp-t-product mzp-t-secondary mzp-t-md" data-referral-id="navigation" '
'data-cta-text="Get Mozilla VPN" >Get Mozilla VPN</a>'
'data-cta-text="Get Mozilla VPN" data-cta-type="vpn">Get Mozilla VPN</a>'
)
self.assertEqual(markup, expected)

0 comments on commit 12793a2

Please sign in to comment.