From 28d8c96fdab36b8364443b610abb74bf020bb504 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Tue, 2 Oct 2018 22:52:26 -0500 Subject: [PATCH 01/28] Better Styling for press page --- common/styles/globalStyles.css | 1 + components/CivicXBadge/CivicXBadge.js | 3 ++- .../__snapshots__/CivicXBadge.test.js.snap | 2 +- components/PressPhotos/PressPhotos.css | 13 ++++--------- components/PressVideos/PressVideos.css | 4 +--- pages/press.js | 6 +++--- pages/styles/press.css | 7 ------- 7 files changed, 12 insertions(+), 24 deletions(-) diff --git a/common/styles/globalStyles.css b/common/styles/globalStyles.css index e108ad8c6..96997fd79 100644 --- a/common/styles/globalStyles.css +++ b/common/styles/globalStyles.css @@ -28,6 +28,7 @@ body { line-height: 1.5; hyphens: none; margin: 0; + min-width: 300px; } h1, diff --git a/components/CivicXBadge/CivicXBadge.js b/components/CivicXBadge/CivicXBadge.js index bb99d6590..c1403c6e4 100644 --- a/components/CivicXBadge/CivicXBadge.js +++ b/components/CivicXBadge/CivicXBadge.js @@ -11,10 +11,11 @@ CivicXBadge.defaultProps = { sourceUrl: 'http://cvcx.org/veterans-solutions-lab/', }; -function CivicXBadge({ sourceUrl = 'http://cvcx.org/veterans-solutions-lab/' }) { +function CivicXBadge({ sourceUrl }) { return (
diff --git a/components/CivicXBadge/__tests__/__snapshots__/CivicXBadge.test.js.snap b/components/CivicXBadge/__tests__/__snapshots__/CivicXBadge.test.js.snap index 1c6728818..de178224c 100644 --- a/components/CivicXBadge/__tests__/__snapshots__/CivicXBadge.test.js.snap +++ b/components/CivicXBadge/__tests__/__snapshots__/CivicXBadge.test.js.snap @@ -5,7 +5,7 @@ exports[`CivicXBadge it should render properly no props 1`] = ` img { + max-width: 350px; width: auto; - max-height: 368px; + padding: 10px; } -@media screen and (min-width: 415px) and (max-width: 1280px) { +@media screen and (max-width: 499px) { .photos > img { - width: 350px; - } -} - -@media screen and (max-width: 414px) { - .photos > img { - width: 300px; + width: 100%; } } diff --git a/components/PressVideos/PressVideos.css b/components/PressVideos/PressVideos.css index 00a868a6a..a336a8663 100644 --- a/components/PressVideos/PressVideos.css +++ b/components/PressVideos/PressVideos.css @@ -13,21 +13,19 @@ /* Video iFrame Media Queries */ @media screen and (max-width: 960px) { .pressVideos iframe { - width: 666px; + width: 100%; height: 375px; } } @media screen and (max-width: 720px) { .pressVideos iframe { - width: 444px; height: 250px; } } @media screen and (max-width: 480px) { .pressVideos iframe { - width: 333px; height: 187.5px; } } diff --git a/pages/press.js b/pages/press.js index 8f72f9516..dcf69f29e 100644 --- a/pages/press.js +++ b/pages/press.js @@ -77,15 +77,15 @@ export default () => (
-
+
-
+
-
+
View Our Branding
diff --git a/pages/styles/press.css b/pages/styles/press.css index 086384b63..976b0d7e7 100644 --- a/pages/styles/press.css +++ b/pages/styles/press.css @@ -43,15 +43,8 @@ } .customContent { - display: -ms-flexbox; - display: flex; - -ms-flex-flow: column; - flex-flow: column; - -ms-flex-pack: justify; - justify-content: space-between; -ms-flex-align: center; align-items: center; - width: 80%; } .logos { From 608e1b863787ad09f4ce8c5fb0affb83e663e8e6 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 01:27:14 -0500 Subject: [PATCH 02/28] Added 3 lists for the "In The News" section. --- components/PressLinks/LinkGroup.js | 56 +++++ components/PressLinks/Links.js | 211 +++++++++++++++++ components/PressLinks/PressLinks.css | 34 +++ components/PressLinks/PressLinks.js | 32 +++ .../PressLinks/__tests__/PressLinks.test.js | 8 + .../__snapshots__/PressLinks.test.js.snap | 216 ++++++++++++++++++ components/_common_/Button/Button.js | 5 +- pages/press.js | 9 +- 8 files changed, 567 insertions(+), 4 deletions(-) create mode 100644 components/PressLinks/LinkGroup.js create mode 100644 components/PressLinks/Links.js create mode 100644 components/PressLinks/PressLinks.css create mode 100644 components/PressLinks/PressLinks.js create mode 100644 components/PressLinks/__tests__/PressLinks.test.js create mode 100644 components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap diff --git a/components/PressLinks/LinkGroup.js b/components/PressLinks/LinkGroup.js new file mode 100644 index 000000000..f0ca57115 --- /dev/null +++ b/components/PressLinks/LinkGroup.js @@ -0,0 +1,56 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import styles from './PressLinks.css'; +import OutboundLink from '../_common_/OutboundLink/OutboundLink'; +import Button from '../_common_/Button/Button'; + +class LinkGroup extends Component { + static propTypes = { + title: PropTypes.string.isRequired, + links: PropTypes.arrayOf( + PropTypes.shape({ + url: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + }), + ).isRequired, + MaxLinks: PropTypes.number.isRequired, + }; + + state = { + ShowAll: false, + }; + + render() { + const { ShowAll } = this.state; + const { title, links, MaxLinks } = this.props; + return ( +
+

{title}

+
    + {links.map((link, index) => { + if (index >= MaxLinks && !ShowAll) { + return null; + } + return ( +
  • + {link.title} +
  • + ); + })} +
+ {links.length > MaxLinks && ( + + )} +
+ ); + } +} + +export default LinkGroup; diff --git a/components/PressLinks/Links.js b/components/PressLinks/Links.js new file mode 100644 index 000000000..5f3b2a1e0 --- /dev/null +++ b/components/PressLinks/Links.js @@ -0,0 +1,211 @@ +const Boston = [ + { + url: 'https://insights.dice.com/2017/01/11/tech-pros-volunteer-fun-ways/', + title: 'How Tech Pros Can Volunteer in Fun Ways', + }, + { + url: + 'https://www.necn.com/news/business/MassChallenge-Finnest_-Operation-Code_-Sunrise-Health_NECN-441063423.html', + title: 'MassChallenge Finalists: Finnest, Operation Code, Sunrise Health', + }, + { + url: 'http://www.wickedbandwidth.com/02072017-techbreakfast-microsoft-nerd/', + title: 'TechBreakfast at Microsoft NERD', + }, + { + url: 'https://www.youtube.com/watch?v=YGaG_HL3oEQ', + title: 'Operation Code - #BNT80 Boston New Technology Startup Demo', + }, + { + url: 'https://www.youtube.com/watch?v=GcvVsVsH-Gg', + title: 'MassChallenge Finalist | Operation Code | Conrad Hollomon', + }, + { + url: + 'https://venturefizz.com/stories/boston/operation-code-creating-coding-community-veterans-and-citizens', + title: 'Operation Code – Creating a Coding Community with Veterans and Citizens', + }, + { + url: 'https://www.deepcoredata.com/innovation-spotlight-veterans-mission-operation-code/', + title: 'Innovation Spotlight: Operation Code', + }, + { + url: 'https://blogs.microsoft.com/newengland/2017/11/10/tech4vets-masschallenge-veterans/', + title: 'tech4vets Masschallenge Veterans', + }, +]; + +const General = [ + { + url: + 'https://blog.opportunityatwork.org/techhire-educator-spotlight-operation-code-debd0a796f9d', + title: 'TechHire Educator Spotlight: Operation Code', + }, + { + url: 'https://www.switchup.org/blog/why-veterans-will-make-excellent-programmers', + title: 'Why Veterans Will Make Excellent Programmers', + }, + { + url: 'https://www.wired.com/story/thousands-of-veterans-want-to-learn-to-code-but-cant/', + title: 'THOUSANDS OF VETERANS WANT TO LEARN TO CODE — BUT CAN’T', + }, + { + url: + 'https://medium.com/the-hum/hacking-entrepreneurship-an-interview-with-david-molina-of-operation-code-12a7e199e4e0', + title: 'Hacking Entrepreneurship — An Interview with David Molina of Operation Code', + }, + { + url: + 'https://medium.com/operation-code/a-marine-vets-path-into-coding-brings-him-back-home-4fcf5645d740', + title: 'A Marine Vet’s Path into Coding Brings Him Back Home', + }, + { + url: 'http://blog.teamtreehouse.com/operation-code-connecting-veterans-with-code', + title: 'Operation Code: Connecting Veterans with Code Skills', + }, + { + url: 'https://blog.github.com/2016-11-11-operation-code-connecting-tech-and-veterans/', + title: 'Operation Code: connecting tech and veterans', + }, + { + url: + 'https://www.geekwire.com/2016/call-duty-technology-veterans-rally-support-operation-code/', + title: + 'When the call of duty is technology, veterans rally to support each other through Operation Code', // eslint-disable-line + }, + { + url: 'https://www.youtube.com/watch?v=qoy7scC2SHk', + title: 'Get Coding Now with Operation Code Army Veteran and Founder David Molina', + }, + { + url: 'https://www.youtube.com/watch?v=xN7yMoe38xc', + title: 'The New Developer - Operation Code - GitHub Universe 2016', + }, + { + url: 'https://www.youtube.com/watch?v=-wSwlLeKFdE', + title: 'What happens when military veterans learn to code - CodeConf 2016', + }, + { + url: 'https://opensource.com/article/17/4/operation-code-mentors-veterans', + title: 'How Operation Code helps veterans learn programming skills', + }, + { + url: + 'https://softwareengineeringdaily.com/2016/03/20/helping-veterans-learn-code-david-molina/', + title: 'Helping Veterans Learn to Code with David Molina', + }, + { + url: 'https://developingstory.netlify.com/tds-66-david-molina-from-operation-code', + title: 'Podcast: a developing story as told by developers', + }, + { + url: 'https://www.instagram.com/p/21p5bFxUjd/?taken-by=davidcmolina', + title: 'Instagram: David Molina', + }, + { + url: + 'http://blog.teamtreehouse.com/from-aviation-electrician-to-back-end-engineering-bret-funk-operation-code-story', + title: 'From Aviation Electrician to Back End Engineering: Bret Funk’s Operation Code story', + }, + { + url: + 'http://blog.teamtreehouse.com/navy-veteran-to-software-developer-geno-guerreros-operation-code-story', + title: 'Navy Veteran to Software Developer: Geno Guerrero’s Operation Code Story', + }, + { + url: 'http://blog.teamtreehouse.com/marine-corps-veteran-front-end-developer-billy-le', + title: 'From Marine Corps Veteran to Front End Developer: Billy Le’s Operation Code Story', + }, + { + url: 'https://techcrunch.com/2015/11/11/few-options-for-veterans-looking-to-enter-tech/', + title: 'Few Options For Veterans Looking To Enter Tech', + }, + { + url: + 'https://www.ibtimes.com/coding-boot-camps-go-after-veterans-take-silicon-valleys-vacant-tech-jobs-2174421', + title: "Coding Boot Camps Go After Veterans To Take Silicon Valley's Vacant Tech Jobs", + }, + { + url: 'https://www.makeschool.com/blog/20-diversity-and-inclusion-leaders-to-follow-in-2018', + title: '20 Diversity and Inclusion Leaders to Follow in 2018', + }, + { + url: + 'http://bitshare.cm/news/tech-innovation-meets-military-service-geekwires-memorial-day-remembrance-and-update/', + title: 'Tech innovation meets military service: GeekWire’s Memorial Day remembrance and update', + }, + { + url: 'https://www.millennialaction.org/press-archives/vetstechpr', + title: "MAP HOSTS CONGRESSIONAL BRIEFING ON VETERANS' READINESS IN TECH CAREERS", + }, + { + url: + 'https://www.advfn.com/news_Analytics-Pros-Inc-Hosts-Training-for-Veterans-a_72657464.html', + title: "Analytics Pros, Inc. Hosts Training for Veterans and Veterans' Spouses", + }, + { + url: + 'http://mentoringdevelopers.com/episode-36-how-to-pick-a-programming-language-to-learn-for-new-developers-part-2/', + title: 'Episode 36 – How to pick a programming language to learn for new developers – Part 2', + }, + { + url: 'https://www.blogs.va.gov/VAntage/33028/upskill-veterans-training-technology-jobs/', + title: 'How to “upskill” Veterans’ training for technology jobs', + }, + { + url: 'https://www.instagram.com/p/BbZT3Q-BBDC/', + title: 'Instagram: Operation Code made the front cover of Oregon Veterans News Magazine', + }, + { + url: 'https://blog.sabio.la/jameel-from-jarhead-to-softwareengineer-9130702da5c1', + title: 'Jameel: From Marines to SoftwareEngineer', + }, + { + url: + 'https://www.seattletimes.com/business/technology/seattles-code-fellows-wins-approval-under-gi-bill/', + title: 'Seattle coding-school tuition to be covered by GI Bill', + }, + { + url: + 'https://www.koin.com/news/veteran-gi-bill-should-cover-code-school_20180208085618706/960235415', + title: 'Veteran: GI Bill should cover code school', + }, + { + url: 'http://patriotbootcamp.org/blog/operation-code', + title: + 'Patriot Boot Camp And Operation Code Join Forces To Help Military Veterans Become Technology Entrepreneurs', // eslint-disable-line + }, + { + url: 'http://www.maswired.com/operation-code-wants-veterans-to-work-in-tech/', + title: 'Operation Code wants veterans to work in tech', + }, + { + url: 'http://diversemilitary.net/2017/06/27/coding-bootcamps-accepts-gi-bill/', + title: 'Coding Bootcamps Accepts GI Bill', + }, + { + url: + 'https://news.clearancejobs.com/2017/07/17/operation-code-looks-help-veterans-land-careers/', + title: 'Operation Code Looks to Help Veterans Land IT Careers', + }, +]; + +const NYC = [ + { + url: + 'https://wtkr.com/2018/05/16/new-program-aims-to-help-veterans-land-jobs-in-tech-industry/', + title: 'New program aims to help veterans land jobs in tech industry', + }, + { + url: + 'http://www.wdtv.com/content/news/Veterans-in-Residence-program-helping-veterans-grow-businesses-482707221.html', + title: 'Veterans in Residence', + }, + { + url: + 'https://www.wework.com/blog/posts/after-flying-solo-veterans-find-others-who-have-their-back', + title: 'After Flying Solo, Veterans Find Others Who Have Their Backs', + }, +]; + +export { NYC, Boston, General }; diff --git a/components/PressLinks/PressLinks.css b/components/PressLinks/PressLinks.css new file mode 100644 index 000000000..1c13cc092 --- /dev/null +++ b/components/PressLinks/PressLinks.css @@ -0,0 +1,34 @@ +.logos a { + color: #249cbc; + text-decoration: none; +} + +.logos .articlesGroup > h2 { + text-align: center; +} + +.logos .articlesGroup { + width: 375px; + padding-top: 15px; +} + +@media screen and (max-width: 414px) { + .logos .articlesGroup { + width: 275px; + } +} + +.flexContainer { + width: 100%; + display: flex; + flex-flow: row wrap; + justify-content: space-around; + padding: 15px 0 0 0; +} + +button.ShowAllButton { + min-width: 100px; + line-height: 0.5; + font-size: 0.9rem; + margin: auto; +} diff --git a/components/PressLinks/PressLinks.js b/components/PressLinks/PressLinks.js new file mode 100644 index 000000000..b86c76e58 --- /dev/null +++ b/components/PressLinks/PressLinks.js @@ -0,0 +1,32 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import styles from './PressLinks.css'; +import * as Links from './Links'; +import LinkGroup from './LinkGroup'; + +PressLinks.propTypes = { + MaxLinks: PropTypes.number, +}; + +PressLinks.defaultProps = { + MaxLinks: 5, +}; + +function PressLinks({ MaxLinks }) { + return ( +
+
+ {Object.keys(Links).map(group => ( + + ))} +
+
+ ); +} + +export default PressLinks; diff --git a/components/PressLinks/__tests__/PressLinks.test.js b/components/PressLinks/__tests__/PressLinks.test.js new file mode 100644 index 000000000..10f6a9334 --- /dev/null +++ b/components/PressLinks/__tests__/PressLinks.test.js @@ -0,0 +1,8 @@ +import React from 'react'; +import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; + +import PressLinks from '../PressLinks'; + +describe('PressLinks', () => { + test('it should render properly no props', () => createShallowSnapshotTest()); +}); diff --git a/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap new file mode 100644 index 000000000..756ff7d77 --- /dev/null +++ b/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap @@ -0,0 +1,216 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PressLinks it should render properly no props 1`] = ` +
+
+ + + +
+
+`; diff --git a/components/_common_/Button/Button.js b/components/_common_/Button/Button.js index 8e8942207..f58908ad8 100644 --- a/components/_common_/Button/Button.js +++ b/components/_common_/Button/Button.js @@ -41,8 +41,9 @@ class Button extends Component { // eslint-disable-next-line no-console console.log('Analytics Disabled', props.analyticsObject); } - - return props.onClick; + if (typeof props.onClick === 'function') { + props.onClick(); + } }; render() { diff --git a/pages/press.js b/pages/press.js index dcf69f29e..162c887cb 100644 --- a/pages/press.js +++ b/pages/press.js @@ -4,6 +4,7 @@ import Head from 'components/head'; import PressVideos from 'components/PressVideos/PressVideos'; import PressPhotos from 'components/PressPhotos/PressPhotos'; import CivicXBadge from 'components/CivicXBadge/CivicXBadge'; +import PressLinks from 'components/PressLinks/PressLinks'; import Section from 'components/_common_/Section/Section'; import styles from './styles/press.css'; @@ -85,13 +86,17 @@ export default () => (
-
+
+ +
+ +
View Our Branding
-
+
Operation Code is a graduate of the following startup accelerators:
From 79b2ebc0476198799249941352383b58090ff0ce Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 01:59:02 -0500 Subject: [PATCH 03/28] Update Button test for onClick --- components/_common_/Button/__tests__/Button.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/_common_/Button/__tests__/Button.test.js b/components/_common_/Button/__tests__/Button.test.js index c2c3e58f9..cb6f2a2dc 100644 --- a/components/_common_/Button/__tests__/Button.test.js +++ b/components/_common_/Button/__tests__/Button.test.js @@ -62,4 +62,12 @@ describe('Button', () => { expect(console.log.mock.calls.length).toEqual(1); /* eslint-enable no-console */ }); + + test('onClick prop should be called', () => { + const onClickMock = jest.fn(); + const ButtonShallowInstance = shallow( diff --git a/components/PressLinks/__tests__/PressLinks.test.js b/components/PressLinks/__tests__/PressLinks.test.js index 10f6a9334..45a2069f7 100644 --- a/components/PressLinks/__tests__/PressLinks.test.js +++ b/components/PressLinks/__tests__/PressLinks.test.js @@ -1,8 +1,64 @@ import React from 'react'; import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; +import { mount, shallow } from 'enzyme'; import PressLinks from '../PressLinks'; +import LinkGroup from '../LinkGroup'; describe('PressLinks', () => { test('it should render properly no props', () => createShallowSnapshotTest()); }); + +describe('PressLinks > LinkGroups', () => { + test('it should render properly with required props', () => + createShallowSnapshotTest( + , + )); + + test('it should render a button', () => + createShallowSnapshotTest( + , + )); + + test('LinkGroup should setState when clicking Show All button', () => { + const LinkGroupShallowInstance = shallow( + , + ); + + LinkGroupShallowInstance.instance().clickHandler(); + + expect(LinkGroupShallowInstance.state().ShowAll).toEqual(true); + }); + + test('LinkGroup should not create a button if not enough links', () => { + const wrap = mount( + , + ); + + expect(wrap.find('button').exists()).toEqual(false); + }); +}); diff --git a/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap index 756ff7d77..ac6e0b726 100644 --- a/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap +++ b/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap @@ -1,5 +1,65 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`PressLinks > LinkGroups it should render a button 1`] = ` +
+

+ test +

+
    +
  • + + Example + +
  • +
+ +
+`; + +exports[`PressLinks > LinkGroups it should render properly with required props 1`] = ` +
+

+ test +

+
    +
  • + + Example + +
  • +
+
+`; + exports[`PressLinks it should render properly no props 1`] = `
Date: Wed, 3 Oct 2018 03:13:49 -0500 Subject: [PATCH 05/28] Move PressLinks into Press --- components/{ => Press}/PressLinks/LinkGroup.js | 4 ++-- components/{ => Press}/PressLinks/Links.js | 0 components/{ => Press}/PressLinks/PressLinks.css | 0 components/{ => Press}/PressLinks/PressLinks.js | 0 .../{ => Press}/PressLinks/__tests__/PressLinks.test.js | 0 .../__tests__/__snapshots__/PressLinks.test.js.snap | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename components/{ => Press}/PressLinks/LinkGroup.js (92%) rename components/{ => Press}/PressLinks/Links.js (100%) rename components/{ => Press}/PressLinks/PressLinks.css (100%) rename components/{ => Press}/PressLinks/PressLinks.js (100%) rename components/{ => Press}/PressLinks/__tests__/PressLinks.test.js (100%) rename components/{ => Press}/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap (100%) diff --git a/components/PressLinks/LinkGroup.js b/components/Press/PressLinks/LinkGroup.js similarity index 92% rename from components/PressLinks/LinkGroup.js rename to components/Press/PressLinks/LinkGroup.js index 29eaeb819..7803180e7 100644 --- a/components/PressLinks/LinkGroup.js +++ b/components/Press/PressLinks/LinkGroup.js @@ -1,8 +1,8 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import styles from './PressLinks.css'; -import OutboundLink from '../_common_/OutboundLink/OutboundLink'; -import Button from '../_common_/Button/Button'; +import OutboundLink from '../../_common_/OutboundLink/OutboundLink'; +import Button from '../../_common_/Button/Button'; class LinkGroup extends Component { static propTypes = { diff --git a/components/PressLinks/Links.js b/components/Press/PressLinks/Links.js similarity index 100% rename from components/PressLinks/Links.js rename to components/Press/PressLinks/Links.js diff --git a/components/PressLinks/PressLinks.css b/components/Press/PressLinks/PressLinks.css similarity index 100% rename from components/PressLinks/PressLinks.css rename to components/Press/PressLinks/PressLinks.css diff --git a/components/PressLinks/PressLinks.js b/components/Press/PressLinks/PressLinks.js similarity index 100% rename from components/PressLinks/PressLinks.js rename to components/Press/PressLinks/PressLinks.js diff --git a/components/PressLinks/__tests__/PressLinks.test.js b/components/Press/PressLinks/__tests__/PressLinks.test.js similarity index 100% rename from components/PressLinks/__tests__/PressLinks.test.js rename to components/Press/PressLinks/__tests__/PressLinks.test.js diff --git a/components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap similarity index 100% rename from components/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap rename to components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap From bbc413a3bc81edcc23d6f5ffa0e59d405758fc32 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 03:26:42 -0500 Subject: [PATCH 06/28] Use proper press import --- pages/press.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/press.js b/pages/press.js index 15ec3c66f..012f2f66c 100644 --- a/pages/press.js +++ b/pages/press.js @@ -2,7 +2,7 @@ import React from 'react'; import Link from 'next/link'; import Head from 'components/head'; import Section from 'components/_common_/Section/Section'; -import { Videos, Photos, CivicXBadge, PressLinks } from 'components/Press'; +import { Videos, Photos, CivicXBadge, Links } from 'components/Press'; import styles from './styles/press.css'; export default () => ( @@ -86,7 +86,7 @@ export default () => (
- +
From dd5cae31c03515f5d9b3c281dc4bc3b30b0c63f0 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 03:31:41 -0500 Subject: [PATCH 07/28] Ignore Links data structure --- jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.js b/jest.config.js index 823a41bf7..dba168610 100644 --- a/jest.config.js +++ b/jest.config.js @@ -44,6 +44,7 @@ module.exports = { '/common/utils/api-utils.js', '/components/FAQ/questions.js', '/components/ZipRecruiterJobs/ZipRecruiterJobs.js', + '/components/Press/PressLinks/Links.js', // Ignore Next.js files '/components/head.js', From 16cb650fd3c02e8a4944e9055e9264e30d8de0d7 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 13:54:41 -0500 Subject: [PATCH 08/28] Changes for project consistancy and readability --- .../__snapshots__/ImageCard.test.js.snap | 1 + components/Press/PressLinks/LinkGroup.js | 25 ++++--- components/Press/PressLinks/PressLinks.css | 10 +-- components/Press/PressLinks/PressLinks.js | 8 +-- .../{PressLinks.test.js => LinkGroup.test.js} | 39 +++++++---- .../PressLinks/__tests__/PressLinks.test.1.js | 8 +++ .../__snapshots__/LinkGroup.test.js.snap | 61 +++++++++++++++++ ...test.js.snap => PressLinks.test.1.js.snap} | 66 +------------------ components/Press/PressPhotos/PressPhotos.css | 2 +- .../__snapshots__/DonateSection.test.js.snap | 1 + .../__snapshots__/JoinSection.test.js.snap | 1 + .../__snapshots__/SignUpSection.test.js.snap | 1 + components/_common_/Button/Button.js | 6 +- pages/styles/press.css | 1 - 14 files changed, 122 insertions(+), 108 deletions(-) rename components/Press/PressLinks/__tests__/{PressLinks.test.js => LinkGroup.test.js} (56%) create mode 100644 components/Press/PressLinks/__tests__/PressLinks.test.1.js create mode 100644 components/Press/PressLinks/__tests__/__snapshots__/LinkGroup.test.js.snap rename components/Press/PressLinks/__tests__/__snapshots__/{PressLinks.test.js.snap => PressLinks.test.1.js.snap} (90%) diff --git a/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap b/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap index e902876ee..d90e6a0f1 100644 --- a/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap +++ b/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap @@ -46,6 +46,7 @@ exports[`ImageCard should render properly with some props assigned 1`] = ` disabled={false} fullWidth={false} href="https://www.testlink.com" + onClick={[Function]} tabIndex={0} theme="primary" type="button" diff --git a/components/Press/PressLinks/LinkGroup.js b/components/Press/PressLinks/LinkGroup.js index 7803180e7..e748797ac 100644 --- a/components/Press/PressLinks/LinkGroup.js +++ b/components/Press/PressLinks/LinkGroup.js @@ -13,27 +13,26 @@ class LinkGroup extends Component { title: PropTypes.string.isRequired, }), ).isRequired, - MaxLinks: PropTypes.number.isRequired, + numberOfInitiallyVisibleLinks: PropTypes.number.isRequired, }; state = { - ShowAll: false, + areAllLinksVisible: false, }; clickHandler = () => { - const { ShowAll } = this.state; - this.setState({ ShowAll: !ShowAll }); + this.setState(prevState => ({ areAllLinksVisible: !prevState.areAllLinksVisible })); }; render() { - const { ShowAll } = this.state; - const { title, links, MaxLinks } = this.props; + const { areAllLinksVisible } = this.state; + const { title, links, numberOfInitiallyVisibleLinks } = this.props; return (

{title}

    {links.map((link, index) => { - if (index >= MaxLinks && !ShowAll) { + if (index >= numberOfInitiallyVisibleLinks && !areAllLinksVisible) { return null; } return ( @@ -43,14 +42,14 @@ class LinkGroup extends Component { ); })}
- {links.length > MaxLinks && ( - )}
diff --git a/components/Press/PressLinks/PressLinks.css b/components/Press/PressLinks/PressLinks.css index 1c13cc092..f3a58acff 100644 --- a/components/Press/PressLinks/PressLinks.css +++ b/components/Press/PressLinks/PressLinks.css @@ -8,16 +8,10 @@ } .logos .articlesGroup { - width: 375px; + max-width: 375px; padding-top: 15px; } -@media screen and (max-width: 414px) { - .logos .articlesGroup { - width: 275px; - } -} - .flexContainer { width: 100%; display: flex; @@ -26,7 +20,7 @@ padding: 15px 0 0 0; } -button.ShowAllButton { +button.areAllLinksVisibleButton { min-width: 100px; line-height: 0.5; font-size: 0.9rem; diff --git a/components/Press/PressLinks/PressLinks.js b/components/Press/PressLinks/PressLinks.js index b86c76e58..d8e28414a 100644 --- a/components/Press/PressLinks/PressLinks.js +++ b/components/Press/PressLinks/PressLinks.js @@ -5,14 +5,14 @@ import * as Links from './Links'; import LinkGroup from './LinkGroup'; PressLinks.propTypes = { - MaxLinks: PropTypes.number, + numberOfInitiallyVisibleLinks: PropTypes.number, }; PressLinks.defaultProps = { - MaxLinks: 5, + numberOfInitiallyVisibleLinks: 5, }; -function PressLinks({ MaxLinks }) { +function PressLinks({ numberOfInitiallyVisibleLinks }) { return (
@@ -21,7 +21,7 @@ function PressLinks({ MaxLinks }) { key={`LinkGroup_${group}`} title={group} links={Links[group]} - MaxLinks={MaxLinks} + numberOfInitiallyVisibleLinks={numberOfInitiallyVisibleLinks} /> ))}
diff --git a/components/Press/PressLinks/__tests__/PressLinks.test.js b/components/Press/PressLinks/__tests__/LinkGroup.test.js similarity index 56% rename from components/Press/PressLinks/__tests__/PressLinks.test.js rename to components/Press/PressLinks/__tests__/LinkGroup.test.js index 45a2069f7..41adc11bb 100644 --- a/components/Press/PressLinks/__tests__/PressLinks.test.js +++ b/components/Press/PressLinks/__tests__/LinkGroup.test.js @@ -2,24 +2,19 @@ import React from 'react'; import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; import { mount, shallow } from 'enzyme'; -import PressLinks from '../PressLinks'; import LinkGroup from '../LinkGroup'; -describe('PressLinks', () => { - test('it should render properly no props', () => createShallowSnapshotTest()); -}); - describe('PressLinks > LinkGroups', () => { - test('it should render properly with required props', () => + test('should render properly with required props', () => createShallowSnapshotTest( , )); - test('it should render a button', () => + test('should render properly with required props and 3 links and a button', () => createShallowSnapshotTest( LinkGroups', () => { { url: 'https://example.com', title: 'Example' }, { url: 'https://example.com', title: 'Example' }, ]} - MaxLinks={1} + numberOfInitiallyVisibleLinks={1} />, )); - test('LinkGroup should setState when clicking Show All button', () => { + test('should setState when clicking Show All button', () => { const LinkGroupShallowInstance = shallow( LinkGroups', () => { { url: 'https://example.com', title: 'Example' }, { url: 'https://example.com', title: 'Example' }, ]} - MaxLinks={1} + numberOfInitiallyVisibleLinks={1} />, ); LinkGroupShallowInstance.instance().clickHandler(); - expect(LinkGroupShallowInstance.state().ShowAll).toEqual(true); + expect(LinkGroupShallowInstance.state().areAllLinksVisible).toEqual(true); }); - test('LinkGroup should not create a button if not enough links', () => { + test('should not create a button if not enough links', () => { const wrap = mount( , ); expect(wrap.find('button').exists()).toEqual(false); }); + + test('should create a button if enough links are available', () => { + const wrap = mount( + , + ); + + expect(wrap.find('button').exists()).toEqual(true); + }); }); diff --git a/components/Press/PressLinks/__tests__/PressLinks.test.1.js b/components/Press/PressLinks/__tests__/PressLinks.test.1.js new file mode 100644 index 000000000..10f6a9334 --- /dev/null +++ b/components/Press/PressLinks/__tests__/PressLinks.test.1.js @@ -0,0 +1,8 @@ +import React from 'react'; +import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; + +import PressLinks from '../PressLinks'; + +describe('PressLinks', () => { + test('it should render properly no props', () => createShallowSnapshotTest()); +}); diff --git a/components/Press/PressLinks/__tests__/__snapshots__/LinkGroup.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/LinkGroup.test.js.snap new file mode 100644 index 000000000..dfbd2fe03 --- /dev/null +++ b/components/Press/PressLinks/__tests__/__snapshots__/LinkGroup.test.js.snap @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PressLinks > LinkGroups should render properly with required props 1`] = ` +
+

+ test +

+
    +
  • + + Example + +
  • +
+
+`; + +exports[`PressLinks > LinkGroups should render properly with required props and 3 links and a button 1`] = ` +
+

+ test +

+
    +
  • + + Example + +
  • +
+ +
+`; diff --git a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap similarity index 90% rename from components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap rename to components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap index ac6e0b726..dc3b128da 100644 --- a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap +++ b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap @@ -1,65 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PressLinks > LinkGroups it should render a button 1`] = ` -
-

- test -

-
    -
  • - - Example - -
  • -
- -
-`; - -exports[`PressLinks > LinkGroups it should render properly with required props 1`] = ` -
-

- test -

-
    -
  • - - Example - -
  • -
-
-`; - exports[`PressLinks it should render properly no props 1`] = `
diff --git a/components/Press/PressPhotos/PressPhotos.css b/components/Press/PressPhotos/PressPhotos.css index a1853ce29..83227f96f 100644 --- a/components/Press/PressPhotos/PressPhotos.css +++ b/components/Press/PressPhotos/PressPhotos.css @@ -9,7 +9,7 @@ .photos > img { max-width: 350px; width: auto; - padding: 10px; + padding: 0.75rem; } @media screen and (max-width: 499px) { diff --git a/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap b/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap index 6ae56b30e..dca4b9c85 100644 --- a/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap +++ b/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap @@ -34,6 +34,7 @@ exports[`DonateSection should render properly with no props 1`] = ` className="" disabled={false} fullWidth={false} + onClick={[Function]} tabIndex={0} theme="primary" type="button" diff --git a/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap b/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap index 3c11ac58d..7d58099c2 100644 --- a/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap +++ b/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap @@ -33,6 +33,7 @@ exports[`JoinSection it should render properly with no props 1`] = ` className="" disabled={false} fullWidth={false} + onClick={[Function]} tabIndex={0} theme="secondary" type="button" diff --git a/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap b/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap index 6d310a595..2f374aa32 100644 --- a/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap +++ b/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap @@ -23,6 +23,7 @@ exports[`SignUpSection it should render properly with no props 1`] = ` className="" disabled={false} fullWidth={false} + onClick={[Function]} tabIndex={0} theme="secondary" type="button" diff --git a/components/_common_/Button/Button.js b/components/_common_/Button/Button.js index f58908ad8..cfb18c522 100644 --- a/components/_common_/Button/Button.js +++ b/components/_common_/Button/Button.js @@ -26,7 +26,7 @@ class Button extends Component { className: '', disabled: false, fullWidth: false, - onClick: undefined, + onClick: () => {}, tabIndex: 0, theme: 'primary', type: 'button', @@ -41,9 +41,7 @@ class Button extends Component { // eslint-disable-next-line no-console console.log('Analytics Disabled', props.analyticsObject); } - if (typeof props.onClick === 'function') { - props.onClick(); - } + props.onClick(); }; render() { diff --git a/pages/styles/press.css b/pages/styles/press.css index 976b0d7e7..9aca78ddc 100644 --- a/pages/styles/press.css +++ b/pages/styles/press.css @@ -43,7 +43,6 @@ } .customContent { - -ms-flex-align: center; align-items: center; } From 0945f7ce7952208307b7e20e65c7b6a21ee08751 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 14:02:43 -0500 Subject: [PATCH 09/28] Press Articles readability, and fixed tests --- .../{LinkGroup.js => ArticleItem.js} | 4 ++-- .../PressLinks/{Links.js => Articles.js} | 0 components/Press/PressLinks/PressLinks.js | 12 +++++------ ...{LinkGroup.test.js => ArticleItem.test.js} | 20 +++++++++---------- ...ressLinks.test.1.js => PressLinks.test.js} | 0 ....test.js.snap => ArticleItem.test.js.snap} | 4 ++-- ...test.1.js.snap => PressLinks.test.js.snap} | 6 +++--- .../_common_/Button/__tests__/Button.test.js | 2 +- jest.config.js | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) rename components/Press/PressLinks/{LinkGroup.js => ArticleItem.js} (96%) rename components/Press/PressLinks/{Links.js => Articles.js} (100%) rename components/Press/PressLinks/__tests__/{LinkGroup.test.js => ArticleItem.test.js} (83%) rename components/Press/PressLinks/__tests__/{PressLinks.test.1.js => PressLinks.test.js} (100%) rename components/Press/PressLinks/__tests__/__snapshots__/{LinkGroup.test.js.snap => ArticleItem.test.js.snap} (82%) rename components/Press/PressLinks/__tests__/__snapshots__/{PressLinks.test.1.js.snap => PressLinks.test.js.snap} (99%) diff --git a/components/Press/PressLinks/LinkGroup.js b/components/Press/PressLinks/ArticleItem.js similarity index 96% rename from components/Press/PressLinks/LinkGroup.js rename to components/Press/PressLinks/ArticleItem.js index e748797ac..675f8f180 100644 --- a/components/Press/PressLinks/LinkGroup.js +++ b/components/Press/PressLinks/ArticleItem.js @@ -4,7 +4,7 @@ import styles from './PressLinks.css'; import OutboundLink from '../../_common_/OutboundLink/OutboundLink'; import Button from '../../_common_/Button/Button'; -class LinkGroup extends Component { +class ArticleItem extends Component { static propTypes = { title: PropTypes.string.isRequired, links: PropTypes.arrayOf( @@ -57,4 +57,4 @@ class LinkGroup extends Component { } } -export default LinkGroup; +export default ArticleItem; diff --git a/components/Press/PressLinks/Links.js b/components/Press/PressLinks/Articles.js similarity index 100% rename from components/Press/PressLinks/Links.js rename to components/Press/PressLinks/Articles.js diff --git a/components/Press/PressLinks/PressLinks.js b/components/Press/PressLinks/PressLinks.js index d8e28414a..ff74eb60e 100644 --- a/components/Press/PressLinks/PressLinks.js +++ b/components/Press/PressLinks/PressLinks.js @@ -1,8 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import styles from './PressLinks.css'; -import * as Links from './Links'; -import LinkGroup from './LinkGroup'; +import * as Articles from './Articles'; +import ArticleItem from './ArticleItem'; PressLinks.propTypes = { numberOfInitiallyVisibleLinks: PropTypes.number, @@ -16,11 +16,11 @@ function PressLinks({ numberOfInitiallyVisibleLinks }) { return (
- {Object.keys(Links).map(group => ( - ( + ))} diff --git a/components/Press/PressLinks/__tests__/LinkGroup.test.js b/components/Press/PressLinks/__tests__/ArticleItem.test.js similarity index 83% rename from components/Press/PressLinks/__tests__/LinkGroup.test.js rename to components/Press/PressLinks/__tests__/ArticleItem.test.js index 41adc11bb..b5a3e1cd7 100644 --- a/components/Press/PressLinks/__tests__/LinkGroup.test.js +++ b/components/Press/PressLinks/__tests__/ArticleItem.test.js @@ -2,12 +2,12 @@ import React from 'react'; import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; import { mount, shallow } from 'enzyme'; -import LinkGroup from '../LinkGroup'; +import ArticleItem from '../ArticleItem'; -describe('PressLinks > LinkGroups', () => { +describe('PressLinks > ArticleItem', () => { test('should render properly with required props', () => createShallowSnapshotTest( - LinkGroups', () => { test('should render properly with required props and 3 links and a button', () => createShallowSnapshotTest( - LinkGroups', () => { )); test('should setState when clicking Show All button', () => { - const LinkGroupShallowInstance = shallow( - LinkGroups', () => { />, ); - LinkGroupShallowInstance.instance().clickHandler(); + ArticleItemShallowInstance.instance().clickHandler(); - expect(LinkGroupShallowInstance.state().areAllLinksVisible).toEqual(true); + expect(ArticleItemShallowInstance.state().areAllLinksVisible).toEqual(true); }); test('should not create a button if not enough links', () => { const wrap = mount( - LinkGroups', () => { test('should create a button if enough links are available', () => { const wrap = mount( - LinkGroups should render properly with required props 1`] = ` +exports[`PressLinks > ArticleItem should render properly with required props 1`] = `
@@ -21,7 +21,7 @@ exports[`PressLinks > LinkGroups should render properly with required props 1`]
`; -exports[`PressLinks > LinkGroups should render properly with required props and 3 links and a button 1`] = ` +exports[`PressLinks > ArticleItem should render properly with required props and 3 links and a button 1`] = `
diff --git a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap similarity index 99% rename from components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap rename to components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap index dc3b128da..70ec2dd2e 100644 --- a/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.1.js.snap +++ b/components/Press/PressLinks/__tests__/__snapshots__/PressLinks.test.js.snap @@ -7,7 +7,7 @@ exports[`PressLinks it should render properly no props 1`] = `
- - - { /* eslint-enable no-console */ }); - test('onClick prop should be called', () => { + test('call props.onClick when button is clicked', () => { const onClickMock = jest.fn(); const ButtonShallowInstance = shallow(, + ); + }); + + test('should spread data and aria props', () => { + createSnapshotTest( + , ); diff --git a/components/_common_/Button/__tests__/__snapshots__/Button.test.js.snap b/components/_common_/Button/__tests__/__snapshots__/Button.test.js.snap index a744d65f6..9b6c73d68 100644 --- a/components/_common_/Button/__tests__/__snapshots__/Button.test.js.snap +++ b/components/_common_/Button/__tests__/__snapshots__/Button.test.js.snap @@ -27,3 +27,19 @@ exports[`Button should render with just required props passed 1`] = ` `; + +exports[`Button should spread data and aria props 1`] = ` + +`; From ed500fab2de0f8d84f6700a4b422aa262d8f15ab Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 15:09:51 -0500 Subject: [PATCH 11/28] Nested Class instead of element class (still winning the war) --- components/Press/PressLinks/PressLinks.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/Press/PressLinks/PressLinks.css b/components/Press/PressLinks/PressLinks.css index f3a58acff..9120b6192 100644 --- a/components/Press/PressLinks/PressLinks.css +++ b/components/Press/PressLinks/PressLinks.css @@ -12,17 +12,17 @@ padding-top: 15px; } -.flexContainer { +.logos .articlesGroup .areAllLinksVisibleButton { + min-width: 100px; + line-height: 0.5; + font-size: 0.9rem; + margin: auto; +} + +.logos .flexContainer { width: 100%; display: flex; flex-flow: row wrap; justify-content: space-around; padding: 15px 0 0 0; } - -button.areAllLinksVisibleButton { - min-width: 100px; - line-height: 0.5; - font-size: 0.9rem; - margin: auto; -} From e53cabd14fc9d71672f0ce6bcdd007acfbf79357 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 15:16:30 -0500 Subject: [PATCH 12/28] Using datum prop button --- .../ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap | 1 + .../PressLinks/__tests__/__snapshots__/ArticleItem.test.js.snap | 1 + .../__tests__/__snapshots__/DonateSection.test.js.snap | 1 + .../__tests__/__snapshots__/JoinSection.test.js.snap | 1 + .../__tests__/__snapshots__/SignUpSection.test.js.snap | 1 + components/_common_/Button/Button.js | 2 ++ 6 files changed, 7 insertions(+) diff --git a/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap b/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap index d90e6a0f1..9674e2a80 100644 --- a/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap +++ b/components/Cards/ImageCard/__tests__/__snapshots__/ImageCard.test.js.snap @@ -43,6 +43,7 @@ exports[`ImageCard should render properly with some props assigned 1`] = ` } } className="" + datum="" disabled={false} fullWidth={false} href="https://www.testlink.com" diff --git a/components/Press/PressLinks/__tests__/__snapshots__/ArticleItem.test.js.snap b/components/Press/PressLinks/__tests__/__snapshots__/ArticleItem.test.js.snap index 81ff61ce4..d196bebd6 100644 --- a/components/Press/PressLinks/__tests__/__snapshots__/ArticleItem.test.js.snap +++ b/components/Press/PressLinks/__tests__/__snapshots__/ArticleItem.test.js.snap @@ -48,6 +48,7 @@ exports[`PressLinks > ArticleItem should render properly with required props and } aria-pressed={false} className="areAllLinksVisibleButton" + datum="" disabled={false} fullWidth={false} onClick={[Function]} diff --git a/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap b/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap index dca4b9c85..0065e9a9e 100644 --- a/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap +++ b/components/ReusableSections/DonateSection/__tests__/__snapshots__/DonateSection.test.js.snap @@ -32,6 +32,7 @@ exports[`DonateSection should render properly with no props 1`] = ` } } className="" + datum="" disabled={false} fullWidth={false} onClick={[Function]} diff --git a/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap b/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap index 7d58099c2..eaa1da125 100644 --- a/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap +++ b/components/ReusableSections/JoinSection/__tests__/__snapshots__/JoinSection.test.js.snap @@ -31,6 +31,7 @@ exports[`JoinSection it should render properly with no props 1`] = ` } } className="" + datum="" disabled={false} fullWidth={false} onClick={[Function]} diff --git a/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap b/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap index 2f374aa32..2766f0fef 100644 --- a/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap +++ b/components/ReusableSections/SignUpSection/__tests__/__snapshots__/SignUpSection.test.js.snap @@ -21,6 +21,7 @@ exports[`SignUpSection it should render properly with no props 1`] = ` } } className="" + datum="" disabled={false} fullWidth={false} onClick={[Function]} diff --git a/components/_common_/Button/Button.js b/components/_common_/Button/Button.js index dc8f3a9e9..6f94a9f28 100644 --- a/components/_common_/Button/Button.js +++ b/components/_common_/Button/Button.js @@ -17,6 +17,7 @@ class Button extends Component { tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), theme: PropTypes.oneOf(['primary', 'secondary', 'slate']), type: PropTypes.oneOf(['button', 'reset', 'submit']), + datum: PropTypes.any, // eslint-disable-line }; static defaultProps = { @@ -31,6 +32,7 @@ class Button extends Component { tabIndex: 0, theme: 'primary', type: 'button', + datum: '', }; clickHandler = () => { From eab9302642dac0336f027234481ec2b714b6a057 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 15:45:16 -0500 Subject: [PATCH 13/28] Asc Order on objects --- components/Press/PressLinks/ArticleItem.js | 4 +- components/Press/PressLinks/Articles.js | 92 +++++++++---------- .../PressLinks/__tests__/ArticleItem.test.js | 22 ++--- components/_common_/Button/Button.js | 4 +- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/components/Press/PressLinks/ArticleItem.js b/components/Press/PressLinks/ArticleItem.js index 675f8f180..a132db8d0 100644 --- a/components/Press/PressLinks/ArticleItem.js +++ b/components/Press/PressLinks/ArticleItem.js @@ -6,14 +6,14 @@ import Button from '../../_common_/Button/Button'; class ArticleItem extends Component { static propTypes = { - title: PropTypes.string.isRequired, links: PropTypes.arrayOf( PropTypes.shape({ - url: PropTypes.string.isRequired, title: PropTypes.string.isRequired, + url: PropTypes.string.isRequired, }), ).isRequired, numberOfInitiallyVisibleLinks: PropTypes.number.isRequired, + title: PropTypes.string.isRequired, }; state = { diff --git a/components/Press/PressLinks/Articles.js b/components/Press/PressLinks/Articles.js index 5f3b2a1e0..603f6d680 100644 --- a/components/Press/PressLinks/Articles.js +++ b/components/Press/PressLinks/Articles.js @@ -1,210 +1,210 @@ const Boston = [ { - url: 'https://insights.dice.com/2017/01/11/tech-pros-volunteer-fun-ways/', title: 'How Tech Pros Can Volunteer in Fun Ways', + url: 'https://insights.dice.com/2017/01/11/tech-pros-volunteer-fun-ways/', }, { + title: 'MassChallenge Finalists: Finnest, Operation Code, Sunrise Health', url: 'https://www.necn.com/news/business/MassChallenge-Finnest_-Operation-Code_-Sunrise-Health_NECN-441063423.html', - title: 'MassChallenge Finalists: Finnest, Operation Code, Sunrise Health', }, { - url: 'http://www.wickedbandwidth.com/02072017-techbreakfast-microsoft-nerd/', title: 'TechBreakfast at Microsoft NERD', + url: 'http://www.wickedbandwidth.com/02072017-techbreakfast-microsoft-nerd/', }, { - url: 'https://www.youtube.com/watch?v=YGaG_HL3oEQ', title: 'Operation Code - #BNT80 Boston New Technology Startup Demo', + url: 'https://www.youtube.com/watch?v=YGaG_HL3oEQ', }, { - url: 'https://www.youtube.com/watch?v=GcvVsVsH-Gg', title: 'MassChallenge Finalist | Operation Code | Conrad Hollomon', + url: 'https://www.youtube.com/watch?v=GcvVsVsH-Gg', }, { + title: 'Operation Code – Creating a Coding Community with Veterans and Citizens', url: 'https://venturefizz.com/stories/boston/operation-code-creating-coding-community-veterans-and-citizens', - title: 'Operation Code – Creating a Coding Community with Veterans and Citizens', }, { - url: 'https://www.deepcoredata.com/innovation-spotlight-veterans-mission-operation-code/', title: 'Innovation Spotlight: Operation Code', + url: 'https://www.deepcoredata.com/innovation-spotlight-veterans-mission-operation-code/', }, { - url: 'https://blogs.microsoft.com/newengland/2017/11/10/tech4vets-masschallenge-veterans/', title: 'tech4vets Masschallenge Veterans', + url: 'https://blogs.microsoft.com/newengland/2017/11/10/tech4vets-masschallenge-veterans/', }, ]; const General = [ { + title: 'TechHire Educator Spotlight: Operation Code', url: 'https://blog.opportunityatwork.org/techhire-educator-spotlight-operation-code-debd0a796f9d', - title: 'TechHire Educator Spotlight: Operation Code', }, { - url: 'https://www.switchup.org/blog/why-veterans-will-make-excellent-programmers', title: 'Why Veterans Will Make Excellent Programmers', + url: 'https://www.switchup.org/blog/why-veterans-will-make-excellent-programmers', }, { - url: 'https://www.wired.com/story/thousands-of-veterans-want-to-learn-to-code-but-cant/', title: 'THOUSANDS OF VETERANS WANT TO LEARN TO CODE — BUT CAN’T', + url: 'https://www.wired.com/story/thousands-of-veterans-want-to-learn-to-code-but-cant/', }, { + title: 'Hacking Entrepreneurship — An Interview with David Molina of Operation Code', url: 'https://medium.com/the-hum/hacking-entrepreneurship-an-interview-with-david-molina-of-operation-code-12a7e199e4e0', - title: 'Hacking Entrepreneurship — An Interview with David Molina of Operation Code', }, { + title: 'A Marine Vet’s Path into Coding Brings Him Back Home', url: 'https://medium.com/operation-code/a-marine-vets-path-into-coding-brings-him-back-home-4fcf5645d740', - title: 'A Marine Vet’s Path into Coding Brings Him Back Home', }, { - url: 'http://blog.teamtreehouse.com/operation-code-connecting-veterans-with-code', title: 'Operation Code: Connecting Veterans with Code Skills', + url: 'http://blog.teamtreehouse.com/operation-code-connecting-veterans-with-code', }, { - url: 'https://blog.github.com/2016-11-11-operation-code-connecting-tech-and-veterans/', title: 'Operation Code: connecting tech and veterans', + url: 'https://blog.github.com/2016-11-11-operation-code-connecting-tech-and-veterans/', }, { - url: - 'https://www.geekwire.com/2016/call-duty-technology-veterans-rally-support-operation-code/', title: 'When the call of duty is technology, veterans rally to support each other through Operation Code', // eslint-disable-line + url: + 'https://www.geekwire.com/2016/call-duty-technology-veterans-rally-support-operation-code/', }, { - url: 'https://www.youtube.com/watch?v=qoy7scC2SHk', title: 'Get Coding Now with Operation Code Army Veteran and Founder David Molina', + url: 'https://www.youtube.com/watch?v=qoy7scC2SHk', }, { - url: 'https://www.youtube.com/watch?v=xN7yMoe38xc', title: 'The New Developer - Operation Code - GitHub Universe 2016', + url: 'https://www.youtube.com/watch?v=xN7yMoe38xc', }, { - url: 'https://www.youtube.com/watch?v=-wSwlLeKFdE', title: 'What happens when military veterans learn to code - CodeConf 2016', + url: 'https://www.youtube.com/watch?v=-wSwlLeKFdE', }, { - url: 'https://opensource.com/article/17/4/operation-code-mentors-veterans', title: 'How Operation Code helps veterans learn programming skills', + url: 'https://opensource.com/article/17/4/operation-code-mentors-veterans', }, { + title: 'Helping Veterans Learn to Code with David Molina', url: 'https://softwareengineeringdaily.com/2016/03/20/helping-veterans-learn-code-david-molina/', - title: 'Helping Veterans Learn to Code with David Molina', }, { - url: 'https://developingstory.netlify.com/tds-66-david-molina-from-operation-code', title: 'Podcast: a developing story as told by developers', + url: 'https://developingstory.netlify.com/tds-66-david-molina-from-operation-code', }, { - url: 'https://www.instagram.com/p/21p5bFxUjd/?taken-by=davidcmolina', title: 'Instagram: David Molina', + url: 'https://www.instagram.com/p/21p5bFxUjd/?taken-by=davidcmolina', }, { + title: 'From Aviation Electrician to Back End Engineering: Bret Funk’s Operation Code story', url: 'http://blog.teamtreehouse.com/from-aviation-electrician-to-back-end-engineering-bret-funk-operation-code-story', - title: 'From Aviation Electrician to Back End Engineering: Bret Funk’s Operation Code story', }, { + title: 'Navy Veteran to Software Developer: Geno Guerrero’s Operation Code Story', url: 'http://blog.teamtreehouse.com/navy-veteran-to-software-developer-geno-guerreros-operation-code-story', - title: 'Navy Veteran to Software Developer: Geno Guerrero’s Operation Code Story', }, { - url: 'http://blog.teamtreehouse.com/marine-corps-veteran-front-end-developer-billy-le', title: 'From Marine Corps Veteran to Front End Developer: Billy Le’s Operation Code Story', + url: 'http://blog.teamtreehouse.com/marine-corps-veteran-front-end-developer-billy-le', }, { - url: 'https://techcrunch.com/2015/11/11/few-options-for-veterans-looking-to-enter-tech/', title: 'Few Options For Veterans Looking To Enter Tech', + url: 'https://techcrunch.com/2015/11/11/few-options-for-veterans-looking-to-enter-tech/', }, { + title: "Coding Boot Camps Go After Veterans To Take Silicon Valley's Vacant Tech Jobs", url: 'https://www.ibtimes.com/coding-boot-camps-go-after-veterans-take-silicon-valleys-vacant-tech-jobs-2174421', - title: "Coding Boot Camps Go After Veterans To Take Silicon Valley's Vacant Tech Jobs", }, { - url: 'https://www.makeschool.com/blog/20-diversity-and-inclusion-leaders-to-follow-in-2018', title: '20 Diversity and Inclusion Leaders to Follow in 2018', + url: 'https://www.makeschool.com/blog/20-diversity-and-inclusion-leaders-to-follow-in-2018', }, { + title: 'Tech innovation meets military service: GeekWire’s Memorial Day remembrance and update', url: 'http://bitshare.cm/news/tech-innovation-meets-military-service-geekwires-memorial-day-remembrance-and-update/', - title: 'Tech innovation meets military service: GeekWire’s Memorial Day remembrance and update', }, { - url: 'https://www.millennialaction.org/press-archives/vetstechpr', title: "MAP HOSTS CONGRESSIONAL BRIEFING ON VETERANS' READINESS IN TECH CAREERS", + url: 'https://www.millennialaction.org/press-archives/vetstechpr', }, { + title: "Analytics Pros, Inc. Hosts Training for Veterans and Veterans' Spouses", url: 'https://www.advfn.com/news_Analytics-Pros-Inc-Hosts-Training-for-Veterans-a_72657464.html', - title: "Analytics Pros, Inc. Hosts Training for Veterans and Veterans' Spouses", }, { + title: 'Episode 36 – How to pick a programming language to learn for new developers – Part 2', url: 'http://mentoringdevelopers.com/episode-36-how-to-pick-a-programming-language-to-learn-for-new-developers-part-2/', - title: 'Episode 36 – How to pick a programming language to learn for new developers – Part 2', }, { - url: 'https://www.blogs.va.gov/VAntage/33028/upskill-veterans-training-technology-jobs/', title: 'How to “upskill” Veterans’ training for technology jobs', + url: 'https://www.blogs.va.gov/VAntage/33028/upskill-veterans-training-technology-jobs/', }, { - url: 'https://www.instagram.com/p/BbZT3Q-BBDC/', title: 'Instagram: Operation Code made the front cover of Oregon Veterans News Magazine', + url: 'https://www.instagram.com/p/BbZT3Q-BBDC/', }, { - url: 'https://blog.sabio.la/jameel-from-jarhead-to-softwareengineer-9130702da5c1', title: 'Jameel: From Marines to SoftwareEngineer', + url: 'https://blog.sabio.la/jameel-from-jarhead-to-softwareengineer-9130702da5c1', }, { + title: 'Seattle coding-school tuition to be covered by GI Bill', url: 'https://www.seattletimes.com/business/technology/seattles-code-fellows-wins-approval-under-gi-bill/', - title: 'Seattle coding-school tuition to be covered by GI Bill', }, { + title: 'Veteran: GI Bill should cover code school', url: 'https://www.koin.com/news/veteran-gi-bill-should-cover-code-school_20180208085618706/960235415', - title: 'Veteran: GI Bill should cover code school', }, { - url: 'http://patriotbootcamp.org/blog/operation-code', title: 'Patriot Boot Camp And Operation Code Join Forces To Help Military Veterans Become Technology Entrepreneurs', // eslint-disable-line + url: 'http://patriotbootcamp.org/blog/operation-code', }, { - url: 'http://www.maswired.com/operation-code-wants-veterans-to-work-in-tech/', title: 'Operation Code wants veterans to work in tech', + url: 'http://www.maswired.com/operation-code-wants-veterans-to-work-in-tech/', }, { - url: 'http://diversemilitary.net/2017/06/27/coding-bootcamps-accepts-gi-bill/', title: 'Coding Bootcamps Accepts GI Bill', + url: 'http://diversemilitary.net/2017/06/27/coding-bootcamps-accepts-gi-bill/', }, { + title: 'Operation Code Looks to Help Veterans Land IT Careers', url: 'https://news.clearancejobs.com/2017/07/17/operation-code-looks-help-veterans-land-careers/', - title: 'Operation Code Looks to Help Veterans Land IT Careers', }, ]; const NYC = [ { + title: 'New program aims to help veterans land jobs in tech industry', url: 'https://wtkr.com/2018/05/16/new-program-aims-to-help-veterans-land-jobs-in-tech-industry/', - title: 'New program aims to help veterans land jobs in tech industry', }, { + title: 'Veterans in Residence', url: 'http://www.wdtv.com/content/news/Veterans-in-Residence-program-helping-veterans-grow-businesses-482707221.html', - title: 'Veterans in Residence', }, { + title: 'After Flying Solo, Veterans Find Others Who Have Their Backs', url: 'https://www.wework.com/blog/posts/after-flying-solo-veterans-find-others-who-have-their-back', - title: 'After Flying Solo, Veterans Find Others Who Have Their Backs', }, ]; diff --git a/components/Press/PressLinks/__tests__/ArticleItem.test.js b/components/Press/PressLinks/__tests__/ArticleItem.test.js index b5a3e1cd7..b94fc1b23 100644 --- a/components/Press/PressLinks/__tests__/ArticleItem.test.js +++ b/components/Press/PressLinks/__tests__/ArticleItem.test.js @@ -9,7 +9,7 @@ describe('PressLinks > ArticleItem', () => { createShallowSnapshotTest( , )); @@ -19,9 +19,9 @@ describe('PressLinks > ArticleItem', () => { , @@ -32,9 +32,9 @@ describe('PressLinks > ArticleItem', () => { , @@ -49,7 +49,7 @@ describe('PressLinks > ArticleItem', () => { const wrap = mount( , ); @@ -62,9 +62,9 @@ describe('PressLinks > ArticleItem', () => { , diff --git a/components/_common_/Button/Button.js b/components/_common_/Button/Button.js index 6f94a9f28..9265deac4 100644 --- a/components/_common_/Button/Button.js +++ b/components/_common_/Button/Button.js @@ -22,17 +22,17 @@ class Button extends Component { static defaultProps = { analyticsObject: { - category: 'Interactions', action: 'Button Selected', + category: 'Interactions', }, className: '', + datum: '', disabled: false, fullWidth: false, onClick: () => {}, tabIndex: 0, theme: 'primary', type: 'button', - datum: '', }; clickHandler = () => { From 970e76ba652347ff38e7014696975c694b513497 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 16:01:59 -0500 Subject: [PATCH 14/28] Check if prop actually exists --- components/_common_/Button/__tests__/Button.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/_common_/Button/__tests__/Button.test.js b/components/_common_/Button/__tests__/Button.test.js index 0df7979fd..23873fe77 100644 --- a/components/_common_/Button/__tests__/Button.test.js +++ b/components/_common_/Button/__tests__/Button.test.js @@ -25,6 +25,14 @@ describe('Button', () => { Test , ); + + const wrapper = shallow( + , + ); + expect(wrapper.prop('aria-label')).toEqual('test'); + expect(wrapper.prop('data-attr')).toEqual('test'); }); test('should render without a generated span when children is PropTypes.node', () => { From c15cf7c34e774bb6a342eb3810f26de96aa45482 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 16:17:52 -0500 Subject: [PATCH 15/28] Moved ArticleItem to its own directory and renamed ArticleGroup --- .../PressLinks/ArticleGroup/ArticleGroup.css | 15 ++++++++++++++ .../ArticleGroup.js} | 6 +++--- .../__tests__/ArticleGroup.test.js} | 20 +++++++++---------- .../__snapshots__/ArticleGroup.test.js.snap} | 4 ++-- components/Press/PressLinks/PressLinks.css | 16 --------------- components/Press/PressLinks/PressLinks.js | 6 +++--- 6 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 components/Press/PressLinks/ArticleGroup/ArticleGroup.css rename components/Press/PressLinks/{ArticleItem.js => ArticleGroup/ArticleGroup.js} (91%) rename components/Press/PressLinks/{__tests__/ArticleItem.test.js => ArticleGroup/__tests__/ArticleGroup.test.js} (83%) rename components/Press/PressLinks/{__tests__/__snapshots__/ArticleItem.test.js.snap => ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap} (82%) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.css b/components/Press/PressLinks/ArticleGroup/ArticleGroup.css new file mode 100644 index 000000000..3ecdce538 --- /dev/null +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.css @@ -0,0 +1,15 @@ +.articlesGroup > h2 { + text-align: center; +} + +.articlesGroup { + max-width: 375px; + padding-top: 15px; +} + +.articlesGroup .areAllLinksVisibleButton { + min-width: 100px; + line-height: 0.5; + font-size: 0.9rem; + margin: auto; +} diff --git a/components/Press/PressLinks/ArticleItem.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js similarity index 91% rename from components/Press/PressLinks/ArticleItem.js rename to components/Press/PressLinks/ArticleGroup/ArticleGroup.js index a132db8d0..7a2dad86d 100644 --- a/components/Press/PressLinks/ArticleItem.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -1,8 +1,8 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import styles from './PressLinks.css'; -import OutboundLink from '../../_common_/OutboundLink/OutboundLink'; -import Button from '../../_common_/Button/Button'; +import OutboundLink from '../../../_common_/OutboundLink/OutboundLink'; +import Button from '../../../_common_/Button/Button'; +import styles from './ArticleGroup.css'; class ArticleItem extends Component { static propTypes = { diff --git a/components/Press/PressLinks/__tests__/ArticleItem.test.js b/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js similarity index 83% rename from components/Press/PressLinks/__tests__/ArticleItem.test.js rename to components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js index b94fc1b23..6dd056414 100644 --- a/components/Press/PressLinks/__tests__/ArticleItem.test.js +++ b/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js @@ -2,12 +2,12 @@ import React from 'react'; import createShallowSnapshotTest from 'test-utils/createShallowSnapshotTest'; import { mount, shallow } from 'enzyme'; -import ArticleItem from '../ArticleItem'; +import ArticleGroup from '../ArticleGroup'; -describe('PressLinks > ArticleItem', () => { +describe('PressLinks > ArticleGroup', () => { test('should render properly with required props', () => createShallowSnapshotTest( - ArticleItem', () => { test('should render properly with required props and 3 links and a button', () => createShallowSnapshotTest( - ArticleItem', () => { )); test('should setState when clicking Show All button', () => { - const ArticleItemShallowInstance = shallow( - ArticleItem', () => { />, ); - ArticleItemShallowInstance.instance().clickHandler(); + ArticleGroupShallowInstance.instance().clickHandler(); - expect(ArticleItemShallowInstance.state().areAllLinksVisible).toEqual(true); + expect(ArticleGroupShallowInstance.state().areAllLinksVisible).toEqual(true); }); test('should not create a button if not enough links', () => { const wrap = mount( - ArticleItem', () => { test('should create a button if enough links are available', () => { const wrap = mount( - ArticleItem should render properly with required props 1`] = ` +exports[`PressLinks > ArticleGroup should render properly with required props 1`] = `
@@ -21,7 +21,7 @@ exports[`PressLinks > ArticleItem should render properly with required props 1`]
`; -exports[`PressLinks > ArticleItem should render properly with required props and 3 links and a button 1`] = ` +exports[`PressLinks > ArticleGroup should render properly with required props and 3 links and a button 1`] = `
diff --git a/components/Press/PressLinks/PressLinks.css b/components/Press/PressLinks/PressLinks.css index 9120b6192..cdd729881 100644 --- a/components/Press/PressLinks/PressLinks.css +++ b/components/Press/PressLinks/PressLinks.css @@ -3,22 +3,6 @@ text-decoration: none; } -.logos .articlesGroup > h2 { - text-align: center; -} - -.logos .articlesGroup { - max-width: 375px; - padding-top: 15px; -} - -.logos .articlesGroup .areAllLinksVisibleButton { - min-width: 100px; - line-height: 0.5; - font-size: 0.9rem; - margin: auto; -} - .logos .flexContainer { width: 100%; display: flex; diff --git a/components/Press/PressLinks/PressLinks.js b/components/Press/PressLinks/PressLinks.js index ff74eb60e..4214741cd 100644 --- a/components/Press/PressLinks/PressLinks.js +++ b/components/Press/PressLinks/PressLinks.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import styles from './PressLinks.css'; import * as Articles from './Articles'; -import ArticleItem from './ArticleItem'; +import ArticleGroup from './ArticleGroup/ArticleGroup'; PressLinks.propTypes = { numberOfInitiallyVisibleLinks: PropTypes.number, @@ -17,8 +17,8 @@ function PressLinks({ numberOfInitiallyVisibleLinks }) {
{Object.keys(Articles).map(group => ( - Date: Wed, 3 Oct 2018 14:24:01 -0700 Subject: [PATCH 16/28] Use module resolved paths instead of relative paths --- components/Press/PressLinks/ArticleGroup/ArticleGroup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js index 7a2dad86d..6a0e8e428 100644 --- a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import OutboundLink from '../../../_common_/OutboundLink/OutboundLink'; -import Button from '../../../_common_/Button/Button'; +import OutboundLink from 'components/_common_/OutboundLink/OutboundLink'; +import Button from 'components/_common_/Button/Button'; import styles from './ArticleGroup.css'; class ArticleItem extends Component { From b9c0f9f65be441938521929817909c534cf0d8ce Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Wed, 3 Oct 2018 14:25:05 -0700 Subject: [PATCH 17/28] Rename component class --- components/Press/PressLinks/ArticleGroup/ArticleGroup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js index 6a0e8e428..cc06d0097 100644 --- a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -4,7 +4,7 @@ import OutboundLink from 'components/_common_/OutboundLink/OutboundLink'; import Button from 'components/_common_/Button/Button'; import styles from './ArticleGroup.css'; -class ArticleItem extends Component { +class ArticleGroup extends Component { static propTypes = { links: PropTypes.arrayOf( PropTypes.shape({ @@ -57,4 +57,4 @@ class ArticleItem extends Component { } } -export default ArticleItem; +export default ArticleGroup; From 5ad37dc46881c5eef33625bbe437fa94da89a645 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Wed, 3 Oct 2018 14:25:40 -0700 Subject: [PATCH 18/28] Rename test suite --- .../PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js b/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js index 6dd056414..487ab189c 100644 --- a/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js +++ b/components/Press/PressLinks/ArticleGroup/__tests__/ArticleGroup.test.js @@ -4,7 +4,7 @@ import { mount, shallow } from 'enzyme'; import ArticleGroup from '../ArticleGroup'; -describe('PressLinks > ArticleGroup', () => { +describe('ArticleGroup', () => { test('should render properly with required props', () => createShallowSnapshotTest( Date: Wed, 3 Oct 2018 14:26:11 -0700 Subject: [PATCH 19/28] Update ArticleGroup.test.js.snap --- .../__tests__/__snapshots__/ArticleGroup.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap b/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap index c48996c36..27ee5109e 100644 --- a/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap +++ b/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PressLinks > ArticleGroup should render properly with required props 1`] = ` +exports[`ArticleGroup should render properly with required props 1`] = `
@@ -21,7 +21,7 @@ exports[`PressLinks > ArticleGroup should render properly with required props 1`
`; -exports[`PressLinks > ArticleGroup should render properly with required props and 3 links and a button 1`] = ` +exports[`ArticleGroup should render properly with required props and 3 links and a button 1`] = `
From 0c7d7e5d2b11cb23aac1d2a59705eb67b7ea5df4 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 16:44:47 -0500 Subject: [PATCH 20/28] Dont use snapshot in data and aria testing --- .../_common_/Button/__tests__/Button.test.js | 6 ------ .../__tests__/__snapshots__/Button.test.js.snap | 16 ---------------- 2 files changed, 22 deletions(-) diff --git a/components/_common_/Button/__tests__/Button.test.js b/components/_common_/Button/__tests__/Button.test.js index 23873fe77..cc842b757 100644 --- a/components/_common_/Button/__tests__/Button.test.js +++ b/components/_common_/Button/__tests__/Button.test.js @@ -20,12 +20,6 @@ describe('Button', () => { }); test('should spread data and aria props', () => { - createSnapshotTest( - , - ); - const wrapper = shallow( `; - -exports[`Button should spread data and aria props 1`] = ` - -`; From 55e18a2a923a55d17eeacb9e421e1658de3d0366 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 16:52:22 -0500 Subject: [PATCH 21/28] Use Region and Article for easier readability --- .../PressLinks/ArticleGroup/ArticleGroup.js | 12 +++++------ .../__tests__/ArticleGroup.test.js | 20 +++++++++---------- components/Press/PressLinks/PressLinks.js | 8 ++++---- .../__snapshots__/PressLinks.test.js.snap | 18 ++++++++--------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js index cc06d0097..f1a2303be 100644 --- a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -6,14 +6,14 @@ import styles from './ArticleGroup.css'; class ArticleGroup extends Component { static propTypes = { - links: PropTypes.arrayOf( + articles: PropTypes.arrayOf( PropTypes.shape({ title: PropTypes.string.isRequired, url: PropTypes.string.isRequired, }), ).isRequired, numberOfInitiallyVisibleLinks: PropTypes.number.isRequired, - title: PropTypes.string.isRequired, + region: PropTypes.string.isRequired, }; state = { @@ -26,12 +26,12 @@ class ArticleGroup extends Component { render() { const { areAllLinksVisible } = this.state; - const { title, links, numberOfInitiallyVisibleLinks } = this.props; + const { articles, region, numberOfInitiallyVisibleLinks } = this.props; return (
-

{title}

+

{region}

    - {links.map((link, index) => { + {articles.map((link, index) => { if (index >= numberOfInitiallyVisibleLinks && !areAllLinksVisible) { return null; } @@ -42,7 +42,7 @@ class ArticleGroup extends Component { ); })}
- {links.length > numberOfInitiallyVisibleLinks && ( + {articles.length > numberOfInitiallyVisibleLinks && ( ); ButtonShallowInstance.instance().clickHandler(); expect(onClickMock).toHaveBeenCalledTimes(1); From 5b0853432004a893f15d571bb6c1788f9607ed11 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Wed, 3 Oct 2018 15:38:57 -0700 Subject: [PATCH 26/28] =?UTF-8?q?Retry=20the=20refactor=20=F0=9F=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PressLinks/ArticleGroup/ArticleGroup.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js index 79b6fdf1c..0f77f6219 100644 --- a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -32,15 +32,13 @@ class ArticleGroup extends Component {

{region}

    {articles.map((link, index) => { - if (index < numberOfInitiallyVisibleLinks && areAllLinksVisible) { - return ( -
  • - {link.title} -
  • - ); - } - - return null; + const isArticleVisible = areAllLinksVisible || index < numberOfInitiallyVisibleLinks; + + return isArticleVisible ? ( +
  • + {link.title} +
  • + ) : null; })}
{articles.length > numberOfInitiallyVisibleLinks && ( From dce7e88712560f8e59b4df6cae4ea051c4841842 Mon Sep 17 00:00:00 2001 From: Kyle Holmberg Date: Wed, 3 Oct 2018 15:41:12 -0700 Subject: [PATCH 27/28] Add required prop to on --- components/Press/PressLinks/ArticleGroup/ArticleGroup.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js index 0f77f6219..f598ec0d6 100644 --- a/components/Press/PressLinks/ArticleGroup/ArticleGroup.js +++ b/components/Press/PressLinks/ArticleGroup/ArticleGroup.js @@ -36,7 +36,12 @@ class ArticleGroup extends Component { return isArticleVisible ? (
  • - {link.title} + + {link.title} +
  • ) : null; })} From 03a15429a4a73c06c7f1ddf11bb327039887ab12 Mon Sep 17 00:00:00 2001 From: dirtyredz Date: Wed, 3 Oct 2018 17:48:29 -0500 Subject: [PATCH 28/28] Updated Snap --- .../__tests__/__snapshots__/ArticleGroup.test.js.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap b/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap index 27ee5109e..458a90fb7 100644 --- a/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap +++ b/components/Press/PressLinks/ArticleGroup/__tests__/__snapshots__/ArticleGroup.test.js.snap @@ -10,6 +10,7 @@ exports[`ArticleGroup should render properly with required props 1`] = `