From 90308b841f016b5b83fe87281d406dccb58c677a Mon Sep 17 00:00:00 2001 From: Shivam Singhal Date: Fri, 22 Mar 2019 23:32:15 +0530 Subject: [PATCH] Add Extension Workhop link to header and Footer (#7742) Fixes #7696 --- bin/loading-page.html | 5 +++++ src/amo/components/Footer/index.js | 14 ++++++++++++++ src/amo/components/Header/index.js | 14 ++++++++++++++ src/amo/components/Header/styles.scss | 3 ++- tests/unit/amo/components/TestFooter.js | 12 ++++++++++++ tests/unit/amo/components/TestHeader.js | 17 +++++++++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/bin/loading-page.html b/bin/loading-page.html index 98dd7460fc..f809bcd821 100644 --- a/bin/loading-page.html +++ b/bin/loading-page.html @@ -61,6 +61,11 @@
  • Blog
  • +
  • + + Extension Workshop + +
  • Developer Hub diff --git a/src/amo/components/Footer/index.js b/src/amo/components/Footer/index.js index 90ffbfeec3..b1a576eccd 100644 --- a/src/amo/components/Footer/index.js +++ b/src/amo/components/Footer/index.js @@ -4,6 +4,7 @@ import { compose } from 'redux'; import LanguagePicker from 'amo/components/LanguagePicker'; import Link from 'amo/components/Link'; +import { makeQueryStringWithUTM } from 'amo/utils'; import translate from 'core/i18n/translate'; import Icon from 'ui/components/Icon'; import { sanitizeHTML } from 'core/utils'; @@ -51,6 +52,19 @@ export class FooterBase extends React.Component { {i18n.gettext('Blog')}
  • +
  • + + {i18n.gettext('Extension Workshop')} + +
  • {i18n.gettext('Developer Hub')} diff --git a/src/amo/components/Header/index.js b/src/amo/components/Header/index.js index 01a92ab613..74e992615c 100644 --- a/src/amo/components/Header/index.js +++ b/src/amo/components/Header/index.js @@ -16,6 +16,7 @@ import { getCurrentUser, hasAnyReviewerRelatedPermission, } from 'amo/reducers/users'; +import { makeQueryStringWithUTM } from 'amo/utils'; import { VIEW_CONTEXT_HOME } from 'core/constants'; import translate from 'core/i18n/translate'; import DropdownMenu from 'ui/components/DropdownMenu'; @@ -69,6 +70,19 @@ export class HeaderBase extends React.Component {
    + + {i18n.gettext('Extension Workshop')} + { @@ -41,5 +42,16 @@ describe(__filename, () => { 'href', 'https://developer.mozilla.org/Add-ons/AMO/Policy/Contact', ); + + expect(root.find('.Footer-extension-workshop-link')).toHaveText( + 'Extension Workshop', + ); + expect(root.find('.Footer-extension-workshop-link')).toHaveProp( + 'href', + `https://extensionworkshop.com/${makeQueryStringWithUTM({ + utm_content: 'footer-link', + utm_campaign: null, + })}`, + ); }); }); diff --git a/tests/unit/amo/components/TestHeader.js b/tests/unit/amo/components/TestHeader.js index d89f54d181..db680d6436 100644 --- a/tests/unit/amo/components/TestHeader.js +++ b/tests/unit/amo/components/TestHeader.js @@ -3,6 +3,7 @@ import * as React from 'react'; import { setViewContext } from 'amo/actions/viewContext'; import Header, { HeaderBase } from 'amo/components/Header'; import Link from 'amo/components/Link'; +import { makeQueryStringWithUTM } from 'amo/utils'; import AuthenticateButton from 'core/components/AuthenticateButton'; import DropdownMenu from 'ui/components/DropdownMenu'; import { VIEW_CONTEXT_HOME } from 'core/constants'; @@ -162,4 +163,20 @@ describe(__filename, () => { expect(link.children()).toHaveText('Manage My Submissions'); expect(link).toHaveProp('href', '/developers/addons/'); }); + + it('displays a extension workshop link in header', () => { + const { store } = dispatchSignInActions(); + const wrapper = renderHeader({ store }); + const link = wrapper.find('.Header-extension-workshop-link'); + + expect(link).toHaveLength(1); + expect(link.children()).toHaveText('Extension Workshop'); + expect(link).toHaveProp( + 'href', + `https://extensionworkshop.com/${makeQueryStringWithUTM({ + utm_content: 'header-link', + utm_campaign: null, + })}`, + ); + }); });