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 add12ab commit e6306eb
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bedrock/contentful/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def render(self, node):
rel = ' rel="external noopener"'
# add analytics
cta_text = _make_plain_text(node)
data_cta = f' data-cta-text="{cta_text}"'
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
4 changes: 2 additions & 2 deletions bedrock/contentful/tests/test_contentful_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def test_LinkRenderer__mozilla_link(mock_get_current_request):
output = LinkRenderer({"text": TextRenderer}).render(mozilla_mock_hyperlink_node)
expected = (
'<a href="https://subdomain.mozilla.org/test/page/?utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=TEST" '
' data-cta-text="Example" rel="external noopener">Example</a>'
'data-cta-text="Example" rel="external noopener">Example</a>'
)

assert output == expected
Expand All @@ -534,7 +534,7 @@ def test_LinkRenderer__mozilla_link__existing_utm(mock_get_current_request):
mozilla_mock_hyperlink_node = deepcopy(mock_hyperlink_node)
mozilla_mock_hyperlink_node["data"]["uri"] = "https://mozilla.org/test/page/?utm_source=UTMTEST"
output = LinkRenderer({"text": TextRenderer}).render(mozilla_mock_hyperlink_node)
expected = '<a href="https://mozilla.org/test/page/?utm_source=UTMTEST" ' ' data-cta-text="Example" rel="external noopener">Example</a>'
expected = '<a href="https://mozilla.org/test/page/?utm_source=UTMTEST" ' 'data-cta-text="Example" rel="external noopener">Example</a>'

assert output == expected

Expand Down
2 changes: 1 addition & 1 deletion bedrock/mozorg/templates/mozorg/antiharassment-tool.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h2 class="mzp-c-newsletter-title section-heading">Be the first to know when we
</p>
</div>
<p class="mzp-c-form-submit">
<button class="mzp-c-button c-button-aht-primary mzp-t-xl" id="newsletter-submit" type="submit">Get Product Updates</button>
<button class="mzp-c-button c-button-aht-primary mzp-t-xl" id="newsletter-submit" data-cta-text="Get Product Updates" data-cta-type="newsletter" type="submit">Get Product Updates</button>
<span class="mzp-c-fieldnote">We will only send you Mozilla-related information.</span>
</p>
</fieldset>
Expand Down
2 changes: 1 addition & 1 deletion bedrock/newsletter/templates/newsletter/includes/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h4 class="mzp-c-newsletter-subtitle">{{ subtitle }}</h4>
</div>

<p class="mzp-c-form-submit">
<button type="submit" id="newsletter-submit" class="mzp-c-button {{ button_class }}" data-cta-text="Newsletter Sign Up" data-testid="newsletter-submit-button">
<button type="submit" id="newsletter-submit" class="mzp-c-button {{ button_class }}" data-cta-text="Newsletter Sign Up" data-cta-type="newsletter" data-testid="newsletter-submit-button">
{% if submit_text %}
{{ submit_text }}
{% else %}
Expand Down
4 changes: 2 additions & 2 deletions bedrock/newsletter/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ def test_shows_form_multi(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-firefox-multi")
self.assertEqual(doc("#newsletter-submit")[0].attrib["data-cta-type"], "newsletter")

def test_shows_form_single(self):
"""The MPL page only subscribes to 'mozilla-foundation', so not a multi-newsletter form."""
resp = self.client.get("/en-US/MPL/", follow=True)
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-type"], "newsletter")

@patch("bedrock.newsletter.views.basket")
def test_returns_success(self, basket_mock):
Expand Down
2 changes: 1 addition & 1 deletion bedrock/products/templates/products/mozsocial/invite.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1 class="mzp-c-form-header">{{ ftl('mozsocial-invite-welcome-to-mozillasocial'
</div>

<p class="mzp-c-form-submit">
<button type="submit" id="newsletter-submit" class="mzp-c-button button-dark" data-cta-text="Sign me up">
<button type="submit" id="newsletter-submit" class="mzp-c-button button-dark" data-cta-text="Sign me up" data-cta-type="newsletter">
{{ ftl('newsletter-form-sign-me-up') }}
</button>
</p>
Expand Down
2 changes: 1 addition & 1 deletion bedrock/products/templates/products/vpn/invite.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h1 class="mzp-c-form-header">{{ ftl('vpn-landing-invite-page-heading') }}</h1>
</div>

<p class="mzp-c-form-submit">
<button class="mzp-c-button mzp-t-xl" id="newsletter-submit" type="submit" data-testid="vpn-invite-submit-button">{{ ftl('vpn-shared-waitlist-link') }}</button>
<button class="mzp-c-button mzp-t-xl" id="newsletter-submit" type="submit" data-cta-text="Join the Waitlist" data-cta-type="newsletter" data-testid="vpn-invite-submit-button">{{ ftl('vpn-shared-waitlist-link') }}</button>
</p>

<div class="vpn-invite-privacy">
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/spec/products/vpn/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('WaitListForm', function () {
</select>
</div>
<p class="mzp-c-form-submit">
<button class="mzp-c-button mzp-t-xl" id="newsletter-submit" type="submit">Join the Waitlist</button>
<button class="mzp-c-button mzp-t-xl" id="newsletter-submit" type="submit" data-cta-text="Join the Waitlist" data-cta-type="newsletter">Join the Waitlist</button>
</p>
</fieldset>
</form>
Expand Down

0 comments on commit e6306eb

Please sign in to comment.