Compare commits

..

2 Commits

Author SHA1 Message Date
Chris Pappas
0cf3164901 Merge pull request #28 from edx/cpappas/ENT-1888
fix: updating enterprise marketing link logic
2019-05-10 16:55:50 -04:00
Christopher Pappas
bf8020dfac fix: updating business marketing footer
fix: adding https:// to business marketing link

fix: fixing marketing link for business

fix: fixing marketing link for business
2019-05-10 15:49:40 -04:00
6 changed files with 5693 additions and 5405 deletions

10768
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -84,6 +84,7 @@
"dependencies": {
"@edx/paragon": "^3.8.0",
"prop-types": "^15.5.10",
"query-string": "^6.5.0",
"react": "^16.4.2",
"react-dom": "^16.2.0",
"react-intl": "2.x"

View File

@@ -66,6 +66,10 @@ const App = () => (
siteName="edX"
siteLogo={FooterLogo}
marketingSiteBaseUrl="https://www.example.com"
enterpriseMarketingLink={{
url: 'https://business.edx.org',
queryParams: { utm_test: 'utm_test_value' },
}}
supportUrl="https://www.example.com/support"
contactUrl="https://www.example.com/contact"
openSourceUrl="https://www.example.com/open"

View File

@@ -93,6 +93,10 @@ const completeSiteFooterComponent = mockHandleAllTrackEvents =>
handleAllTrackEvents={mockHandleAllTrackEvents}
supportedLanguages={supportedLanguages}
languageForm={languageForm}
enterpriseMarketingLink={{
url: 'https://business.edx.org',
queryParams: { utm_test: 'utm_test_value' },
}}
/>
</IntlProvider>
);
@@ -125,6 +129,10 @@ describe('<SiteFooter />', () => {
supportedLanguages={supportedLanguages}
languageForm={languageForm}
handleAllTrackEvents={jest.fn()}
enterpriseMarketingLink={{
url: 'https://business.edx.org',
queryParams: { utm_test: 'utm_test_value' },
}}
/>
</IntlProvider>
)).toJSON();
@@ -178,6 +186,28 @@ describe('<SiteFooter />', () => {
)).toJSON();
expect(tree).toMatchSnapshot();
});
it('does not render business links', () => {
const tree = renderer
.create((
<IntlProvider locale="en">
<SiteFooter
siteName="example"
siteLogo={FooterLogo}
marketingSiteBaseUrl="https://www.example.com"
supportUrl="https://www.example.com/support"
contactUrl="https://www.example.com/contact"
openSourceUrl="https://www.example.com/open"
termsOfServiceUrl="https://www.example.com/terms-of-service"
privacyPolicyUrl="https://www.example.com/privacy-policy"
appleAppStoreUrl="https://store.apple.com"
googlePlayUrl="https://play.google.com"
handleAllTrackEvents={jest.fn()}
/>
</IntlProvider>
)).toJSON();
expect(tree).toMatchSnapshot();
});
});
describe('handles analytics', () => {

View File

@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<SiteFooter /> renders correctly does not render language selector 1`] = `
exports[`<SiteFooter /> renders correctly does not render business links 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
@@ -44,10 +44,246 @@ exports[`<SiteFooter /> renders correctly does not render language selector 1`]
</li>
<li>
<a
href="https://www.example.com/enterprise"
href="https://www.example.com/affiliate-program"
>
<span>
example for Business
Affiliates
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/open"
>
<span>
Open example
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/careers"
>
<span>
Careers
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/news-announcements"
>
<span>
News
</span>
</a>
</li>
</ul>
</div>
<div
className="area-3"
>
<h2>
<span>
Legal
</span>
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/terms-of-service"
>
<span>
Terms of Service & Honor Code
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/privacy-policy"
>
<span>
Privacy Policy
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/accessibility"
>
<span>
Accessibility Policy
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/trademarks"
>
<span>
Trademark Policy
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/sitemap"
>
<span>
Sitemap
</span>
</a>
</li>
</ul>
</div>
<div
className="area-4"
>
<h2>
<span>
Connect
</span>
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/blog"
>
<span>
Blog
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/contact"
>
<span>
Contact Us
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/support"
>
<span>
Help Center
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/media-kit"
>
<span>
Media Kit
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/donate"
>
<span>
Donate
</span>
</a>
</li>
</ul>
</div>
<div
className="area-5"
>
<ul
className="d-flex flex-row justify-content-between list-unstyled max-width-264 p-0 mb-5"
>
<li>
<a
href="https://store.apple.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the example mobile app from the Apple App Store"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/app_store_badge_135x40.d0558d910630.svg"
/>
</a>
</li>
<li>
<a
href="https://play.google.com"
onClick={[Function]}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Download the example mobile app from Google Play"
className="max-height-39"
src="https://prod-edxapp.edx-cdn.org/static/images/app/google_play_badge_45.6ea466e328da.png"
/>
</a>
</li>
</ul>
<p>
<span>
© 20122019 example Inc.
</span>
<br />
<span>
EdX, Open edX, and MicroMasters are registered trademarks of edX Inc. | 粤ICP备17044299号-2
</span>
</p>
</div>
</div>
</footer>
`;
exports[`<SiteFooter /> renders correctly does not render language selector 1`] = `
<footer
aria-label="Page Footer"
className="footer d-flex justify-content-center border-top py-3 px-4"
role="contentinfo"
>
<div
className="max-width-1180 d-grid"
>
<div
className="area-1"
>
<a
aria-label="example Home"
href="https://www.example.com/"
onClick={[Function]}
target="_self"
>
<img
alt="example logo"
src="test-file-stub"
/>
</a>
</div>
<div
className="area-2"
>
<h2>
example
</h2>
<ul
className="list-unstyled p-0 m-0"
>
<li>
<a
href="https://www.example.com/about-us"
>
<span>
About
</span>
</a>
</li>
@@ -354,15 +590,6 @@ exports[`<SiteFooter /> renders correctly does not render mobile links 1`] = `
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/enterprise"
>
<span>
example for Business
</span>
</a>
</li>
<li>
<a
href="https://www.example.com/affiliate-program"
@@ -832,7 +1059,7 @@ exports[`<SiteFooter /> renders correctly does not render social links 1`] = `
</li>
<li>
<a
href="https://www.example.com/enterprise"
href="https://business.edx.org/?utm_test=utm_test_value"
>
<span>
example for Business
@@ -1144,7 +1371,7 @@ exports[`<SiteFooter /> renders correctly renders with social and mobile links 1
</li>
<li>
<a
href="https://www.example.com/enterprise"
href="https://business.edx.org/?utm_test=utm_test_value"
>
<span>
example for Business

View File

@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, injectIntl, intlShape } from 'react-intl';
import { Hyperlink } from '@edx/paragon';
import qs from 'query-string';
import messages from './SiteFooter.messages';
@@ -50,6 +51,14 @@ class SiteFooter extends React.Component {
return `${this.props.marketingSiteBaseUrl}${path}`;
}
renderEnterpriseMarketingSiteUrl(enterpriseLinkData) {
const {
queryParams,
url,
} = enterpriseLinkData;
return queryParams ? `${url}/?${qs.stringify(queryParams)}` : url;
}
renderMobileLinks() {
const {
intl,
@@ -92,6 +101,22 @@ class SiteFooter extends React.Component {
return mobileLinks;
}
renderBusinessMarketingListItem() {
const { siteName, enterpriseMarketingLink } = this.props;
return enterpriseMarketingLink && (
<li>
<a href={this.renderEnterpriseMarketingSiteUrl(enterpriseMarketingLink)}>
<FormattedMessage
id="footer.site-footer.link.business"
defaultMessage="{siteName} for Business"
description="A link that points to a business marketing page for a specified website"
values={{ siteName }}
/>
</a>
</li>
);
}
render() {
const {
intl,
@@ -159,15 +184,7 @@ class SiteFooter extends React.Component {
/>
</a>
</li>
<li>
<a href={this.renderMarketingSiteUrl('/enterprise')}>
<FormattedMessage
id="footer.site-footer.link.business"
defaultMessage="{siteName} for Business"
values={{ siteName }}
/>
</a>
</li>
{this.renderBusinessMarketingListItem()}
<li>
<a href={this.renderMarketingSiteUrl('/affiliate-program')}>
<FormattedMessage
@@ -357,6 +374,10 @@ SiteFooter.propTypes = {
siteName: PropTypes.string,
siteLogo: PropTypes.node,
marketingSiteBaseUrl: PropTypes.string,
enterpriseMarketingLink: PropTypes.shape({
url: PropTypes.string,
queryParams: PropTypes.shape({}),
}),
supportUrl: PropTypes.string,
contactUrl: PropTypes.string,
openSourceUrl: PropTypes.string,
@@ -390,6 +411,7 @@ SiteFooter.defaultProps = {
siteName: null,
siteLogo: null,
marketingSiteBaseUrl: null,
enterpriseMarketingLink: null,
supportUrl: null,
contactUrl: null,
openSourceUrl: null,