diff --git a/fixtures/activity_feed/index.js b/fixtures/activity_feed/index.js deleted file mode 100755 index f9f49c3d..00000000 --- a/fixtures/activity_feed/index.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = [ - require('./companies_house/accounts_are_due'), - require('./companies_house/incorporated'), - require('./hmrc/export_of_goods'), - require('./interactions/interaction'), - require('./interactions/investment_project'), - require('./interactions/service_delivery'), - require('./investment_projects/project_added_fdi'), - require('./investment_projects/project_added_non_fdi'), - require('./investment_projects/project_added_cti'), - require('./omis/order_added'), -] diff --git a/src/activity-feed/ActivityFeedCard.jsx b/src/activity-feed/Activity.jsx similarity index 64% rename from src/activity-feed/ActivityFeedCard.jsx rename to src/activity-feed/Activity.jsx index 4bdc0f49..05c81c6b 100644 --- a/src/activity-feed/ActivityFeedCard.jsx +++ b/src/activity-feed/Activity.jsx @@ -2,18 +2,22 @@ import React from 'react' import { find } from 'lodash' import PropTypes from 'prop-types' -import Cards from './activity-feed-cards' +import cards from './cards' -export default class ActivityFeedCard extends React.PureComponent { +export default class Activity extends React.PureComponent { static propTypes = { activity: PropTypes.object.isRequired, - showDetails: PropTypes.bool.isRequired, + showDetails: PropTypes.bool, + } + + static defaultProps = { + showDetails: false, } constructor(props) { super(props) const { activity } = this.props - this.Card = find(Cards, c => c.canRender(activity)) + this.Card = find(cards, c => c.canRender(activity)) } render() { diff --git a/src/activity-feed/ActivityFeed.jsx b/src/activity-feed/ActivityFeed.jsx index 53c88a26..ec20f9b2 100644 --- a/src/activity-feed/ActivityFeed.jsx +++ b/src/activity-feed/ActivityFeed.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import styled from 'styled-components' import { SPACING } from '@govuk-react/constants' -import ActivityFeedCard from './ActivityFeedCard' +import Activity from './Activity' import ActivityFeedHeader from './ActivityFeedHeader' import ActivityFeedFilters from './ActivityFeedFilters' import ActivityFeedPagination from './ActivityFeedPagination' @@ -89,7 +89,7 @@ export default class ActivityFeed extends React.Component { {activities.map(activity => (
  • - +
  • ))}
    diff --git a/src/activity-feed/ActivityFeedCard.stories.jsx b/src/activity-feed/ActivityFeedCard.stories.jsx deleted file mode 100644 index 9f4c1b98..00000000 --- a/src/activity-feed/ActivityFeedCard.stories.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import { storiesOf } from '@storybook/react' - -import ActivityFeedCard from './ActivityFeedCard' -import fixtureInteraction from '../../fixtures/activity_feed/interactions/interaction' -import fixtureInvestmentProject from '../../fixtures/activity_feed/interactions/investment_project' -import foreignDirectInvestment from '../../fixtures/activity_feed/investment_projects/project_added_fdi' -import nonCommitmentToInvest from '../../fixtures/activity_feed/investment_projects/project_added_non_fdi' -import commitmentToInvest from '../../fixtures/activity_feed/investment_projects/project_added_cti' -import orderAdded from '../../fixtures/activity_feed/omis/order_added' - -storiesOf('ActivityFeedCard', module) - .add('interaction', () => ) - .add('investment project - interaction', () => ) - .add('investment project added - FDI', () => ) - .add('investment project added - Non-FDI', () => ) - .add('investment project added - CTI', () => ) - .add('omis - new order added', () => ) diff --git a/fixtures/activity_feed/activity-feed-from-es.json b/src/activity-feed/__fixtures__/activity-feed-from-es.json similarity index 100% rename from fixtures/activity_feed/activity-feed-from-es.json rename to src/activity-feed/__fixtures__/activity-feed-from-es.json diff --git a/fixtures/activity_feed/companies/field_update.json b/src/activity-feed/__fixtures__/companies/field_update.json similarity index 100% rename from fixtures/activity_feed/companies/field_update.json rename to src/activity-feed/__fixtures__/companies/field_update.json diff --git a/fixtures/activity_feed/companies_house/accounts_are_due.json b/src/activity-feed/__fixtures__/companies_house/accounts_are_due.json similarity index 100% rename from fixtures/activity_feed/companies_house/accounts_are_due.json rename to src/activity-feed/__fixtures__/companies_house/accounts_are_due.json diff --git a/fixtures/activity_feed/companies_house/incorporated.json b/src/activity-feed/__fixtures__/companies_house/incorporated.json similarity index 100% rename from fixtures/activity_feed/companies_house/incorporated.json rename to src/activity-feed/__fixtures__/companies_house/incorporated.json diff --git a/fixtures/activity_feed/hmrc/export_of_goods.json b/src/activity-feed/__fixtures__/hmrc/export_of_goods.json similarity index 100% rename from fixtures/activity_feed/hmrc/export_of_goods.json rename to src/activity-feed/__fixtures__/hmrc/export_of_goods.json diff --git a/src/activity-feed/__fixtures__/index.js b/src/activity-feed/__fixtures__/index.js new file mode 100755 index 00000000..27d477a5 --- /dev/null +++ b/src/activity-feed/__fixtures__/index.js @@ -0,0 +1,23 @@ +import accountsAreDueFixture from './companies_house/accounts_are_due' +import incorporatedFixture from './companies_house/incorporated' +import exportOfGoodsFixture from './hmrc/export_of_goods' +import interactionFixture from './interactions/interaction' +import investmentProjectFixture from './interactions/investment_project' +import serviceDeliveryFixture from './interactions/service_delivery' +import projectAddedFdiFixture from './investment_projects/project_added_fdi' +import projectAddedNonFdiFixture from './investment_projects/project_added_non_fdi' +import projectAddedCtiFixture from './investment_projects/project_added_cti' +import orderAddedFixture from './omis/order_added' + +export default [ + accountsAreDueFixture, + incorporatedFixture, + exportOfGoodsFixture, + interactionFixture, + investmentProjectFixture, + serviceDeliveryFixture, + projectAddedFdiFixture, + projectAddedNonFdiFixture, + projectAddedCtiFixture, + orderAddedFixture, +] diff --git a/fixtures/activity_feed/interactions/interaction.json b/src/activity-feed/__fixtures__/interactions/interaction.json similarity index 100% rename from fixtures/activity_feed/interactions/interaction.json rename to src/activity-feed/__fixtures__/interactions/interaction.json diff --git a/fixtures/activity_feed/interactions/investment_project.json b/src/activity-feed/__fixtures__/interactions/investment_project.json similarity index 100% rename from fixtures/activity_feed/interactions/investment_project.json rename to src/activity-feed/__fixtures__/interactions/investment_project.json diff --git a/fixtures/activity_feed/interactions/service_delivery.json b/src/activity-feed/__fixtures__/interactions/service_delivery.json similarity index 100% rename from fixtures/activity_feed/interactions/service_delivery.json rename to src/activity-feed/__fixtures__/interactions/service_delivery.json diff --git a/fixtures/activity_feed/interactions/service_delivery_event.json b/src/activity-feed/__fixtures__/interactions/service_delivery_event.json similarity index 100% rename from fixtures/activity_feed/interactions/service_delivery_event.json rename to src/activity-feed/__fixtures__/interactions/service_delivery_event.json diff --git a/fixtures/activity_feed/investment_projects/project_added_cti.json b/src/activity-feed/__fixtures__/investment_projects/project_added_cti.json similarity index 100% rename from fixtures/activity_feed/investment_projects/project_added_cti.json rename to src/activity-feed/__fixtures__/investment_projects/project_added_cti.json diff --git a/fixtures/activity_feed/investment_projects/project_added_fdi.json b/src/activity-feed/__fixtures__/investment_projects/project_added_fdi.json similarity index 100% rename from fixtures/activity_feed/investment_projects/project_added_fdi.json rename to src/activity-feed/__fixtures__/investment_projects/project_added_fdi.json diff --git a/fixtures/activity_feed/investment_projects/project_added_non_fdi.json b/src/activity-feed/__fixtures__/investment_projects/project_added_non_fdi.json similarity index 100% rename from fixtures/activity_feed/investment_projects/project_added_non_fdi.json rename to src/activity-feed/__fixtures__/investment_projects/project_added_non_fdi.json diff --git a/fixtures/activity_feed/investment_projects/project_land_date_coming_up.json b/src/activity-feed/__fixtures__/investment_projects/project_land_date_coming_up.json similarity index 100% rename from fixtures/activity_feed/investment_projects/project_land_date_coming_up.json rename to src/activity-feed/__fixtures__/investment_projects/project_land_date_coming_up.json diff --git a/fixtures/activity_feed/investment_projects/stage_changed.json b/src/activity-feed/__fixtures__/investment_projects/stage_changed.json similarity index 100% rename from fixtures/activity_feed/investment_projects/stage_changed.json rename to src/activity-feed/__fixtures__/investment_projects/stage_changed.json diff --git a/fixtures/activity_feed/omis/order_added.json b/src/activity-feed/__fixtures__/omis/order_added.json similarity index 100% rename from fixtures/activity_feed/omis/order_added.json rename to src/activity-feed/__fixtures__/omis/order_added.json diff --git a/fixtures/activity_feed/orders/delivery_coming_up.json b/src/activity-feed/__fixtures__/orders/delivery_coming_up.json similarity index 100% rename from fixtures/activity_feed/orders/delivery_coming_up.json rename to src/activity-feed/__fixtures__/orders/delivery_coming_up.json diff --git a/fixtures/activity_feed/orders/order_created.json b/src/activity-feed/__fixtures__/orders/order_created.json similarity index 100% rename from fixtures/activity_feed/orders/order_created.json rename to src/activity-feed/__fixtures__/orders/order_created.json diff --git a/fixtures/activity_feed/orders/status_changed.json b/src/activity-feed/__fixtures__/orders/status_changed.json similarity index 100% rename from fixtures/activity_feed/orders/status_changed.json rename to src/activity-feed/__fixtures__/orders/status_changed.json diff --git a/src/activity-feed/__stories__/Activity.stories.jsx b/src/activity-feed/__stories__/Activity.stories.jsx new file mode 100644 index 00000000..2abbe739 --- /dev/null +++ b/src/activity-feed/__stories__/Activity.stories.jsx @@ -0,0 +1,18 @@ +import React from 'react' +import { storiesOf } from '@storybook/react' + +import Activity from '../Activity' +import fixtureInteraction from '../__fixtures__/interactions/interaction' +import fixtureInvestmentProject from '../__fixtures__/interactions/investment_project' +import foreignDirectInvestment from '../__fixtures__/investment_projects/project_added_fdi' +import nonCommitmentToInvest from '../__fixtures__/investment_projects/project_added_non_fdi' +import commitmentToInvest from '../__fixtures__/investment_projects/project_added_cti' +import orderAdded from '../__fixtures__/omis/order_added' + +storiesOf('Activity', module) + .add('interaction', () => ) + .add('investment project - interaction', () => ) + .add('investment project added - FDI', () => ) + .add('investment project added - Non-FDI', () => ) + .add('investment project added - CTI', () => ) + .add('omis - new order added', () => ) diff --git a/src/activity-feed/ActivityFeed.stories.jsx b/src/activity-feed/__stories__/ActivityFeed.stories.jsx similarity index 93% rename from src/activity-feed/ActivityFeed.stories.jsx rename to src/activity-feed/__stories__/ActivityFeed.stories.jsx index 93f528ff..d4780478 100644 --- a/src/activity-feed/ActivityFeed.stories.jsx +++ b/src/activity-feed/__stories__/ActivityFeed.stories.jsx @@ -4,9 +4,9 @@ import { withKnobs } from '@storybook/addon-knobs' import { GridCol, GridRow, Main } from 'govuk-react' import { SPACING } from '@govuk-react/constants' -import ActivityFeed from './ActivityFeed' -import activityFeedFixtures from '../../fixtures/activity_feed' -import datahubBackground from '../../assets/images/data-hub-one-list-corp.png' +import ActivityFeed from '../ActivityFeed' +import activityFeedFixtures from '../__fixtures__' +import datahubBackground from './images/data-hub-one-list-corp.png' addDecorator(withKnobs) diff --git a/src/activity-feed/ActivityFeedApp.stories.jsx b/src/activity-feed/__stories__/ActivityFeedApp.stories.jsx similarity index 92% rename from src/activity-feed/ActivityFeedApp.stories.jsx rename to src/activity-feed/__stories__/ActivityFeedApp.stories.jsx index 1b45e1a6..08992a2d 100644 --- a/src/activity-feed/ActivityFeedApp.stories.jsx +++ b/src/activity-feed/__stories__/ActivityFeedApp.stories.jsx @@ -2,7 +2,7 @@ import React from 'react' import { addDecorator, storiesOf } from '@storybook/react' import { withKnobs, text } from '@storybook/addon-knobs' -import ActivityFeedApp from './ActivityFeedApp' +import ActivityFeedApp from '../ActivityFeedApp' addDecorator(withKnobs) diff --git a/assets/images/data-hub-one-list-corp.png b/src/activity-feed/__stories__/images/data-hub-one-list-corp.png similarity index 100% rename from assets/images/data-hub-one-list-corp.png rename to src/activity-feed/__stories__/images/data-hub-one-list-corp.png diff --git a/src/activity-feed/ActivityFeedCard.test.jsx b/src/activity-feed/__tests__/Activity.test.jsx similarity index 71% rename from src/activity-feed/ActivityFeedCard.test.jsx rename to src/activity-feed/__tests__/Activity.test.jsx index 2ef355ac..3d013786 100644 --- a/src/activity-feed/ActivityFeedCard.test.jsx +++ b/src/activity-feed/__tests__/Activity.test.jsx @@ -2,28 +2,29 @@ import React from 'react' import renderer from 'react-test-renderer' import moment from 'moment' import { set } from 'lodash' - import MockDate from 'mockdate' -import ActivityFeedCard from './ActivityFeedCard' -import companiesHouseAccountsDueFixture from '../../fixtures/activity_feed/companies_house/accounts_are_due' -import companiesHouseCompaniesFixture from '../../fixtures/activity_feed/companies_house/incorporated' -import hmrcExportersFixture from '../../fixtures/activity_feed/hmrc/export_of_goods' -import interactionActivityFixture from '../../fixtures/activity_feed/interactions/interaction' -import serviceDeliveryActivityFixture from '../../fixtures/activity_feed/interactions/service_delivery' -import investmentProjectsCTIFixture from '../../fixtures/activity_feed/investment_projects/project_added_cti' -import investmentProjectsFDIFixture from '../../fixtures/activity_feed/investment_projects/project_added_fdi' -import investmentProjectsNonFDIFixture from '../../fixtures/activity_feed/investment_projects/project_added_non_fdi' -import orderAddedFixture from '../../fixtures/activity_feed/omis/order_added' + +import Activity from '../Activity' + +import companiesHouseAccountsDueFixture from '../__fixtures__/companies_house/accounts_are_due' +import companiesHouseCompaniesFixture from '../__fixtures__/companies_house/incorporated' +import hmrcExportersFixture from '../__fixtures__/hmrc/export_of_goods' +import interactionActivityFixture from '../__fixtures__/interactions/interaction' +import serviceDeliveryActivityFixture from '../__fixtures__/interactions/service_delivery' +import investmentProjectsCTIFixture from '../__fixtures__/investment_projects/project_added_cti' +import investmentProjectsFDIFixture from '../__fixtures__/investment_projects/project_added_fdi' +import investmentProjectsNonFDIFixture from '../__fixtures__/investment_projects/project_added_non_fdi' +import orderAddedFixture from '../__fixtures__/omis/order_added' // Lock the date so moment's relative date doesn't break our deterministic tests. MockDate.set(1559750582706) -describe('ActivityFeedCard', () => { +describe('Activity', () => { describe('when the interaction is empty', () => { test('should render null', () => { const tree = renderer - .create() + .create() .toJSON() expect(tree).toBeNull() }) @@ -32,7 +33,7 @@ describe('ActivityFeedCard', () => { describe('when there is an interaction', () => { test('should render interaction activity', () => { const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -44,7 +45,7 @@ describe('ActivityFeedCard', () => { set(fixture, 'object.dit:status', 'draft') set(fixture, 'object.startTime', moment().subtract(1, 'years').toISOString()) const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -56,7 +57,7 @@ describe('ActivityFeedCard', () => { set(fixture, 'object.dit:status', 'draft') set(fixture, 'object.startTime', moment().add(1, 'days').toISOString()) const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -68,7 +69,7 @@ describe('ActivityFeedCard', () => { set(fixture, 'object.dit:status', 'draft') set(fixture, 'object.dit:archived', true) const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -79,7 +80,7 @@ describe('ActivityFeedCard', () => { const fixture = { ...interactionActivityFixture } set(fixture, 'object.dit:status', 'complete') const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -88,7 +89,7 @@ describe('ActivityFeedCard', () => { describe('when there is a service delivery', () => { test('should render service delivery activity', () => { const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -102,7 +103,7 @@ describe('ActivityFeedCard', () => { }, } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -116,7 +117,7 @@ describe('ActivityFeedCard', () => { interactionActivityFixture.object.attributedTo.filter(a => !a.type.includes('Person'))) const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -128,7 +129,7 @@ describe('ActivityFeedCard', () => { set(interactionWithoutService, 'object.dit:service', null) const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -138,7 +139,7 @@ describe('ActivityFeedCard', () => { test('should render the CTI investment project activity card', () => { const commitmentToInvest = { ...investmentProjectsCTIFixture } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -148,7 +149,7 @@ describe('ActivityFeedCard', () => { test('should render the FDI investment project activity card', () => { const foreignDirectInvestment = { ...investmentProjectsFDIFixture } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -158,7 +159,7 @@ describe('ActivityFeedCard', () => { test('should render the Non-FDI investment project activity card', () => { const nonForeignDirectInvestment = { ...investmentProjectsNonFDIFixture } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -168,7 +169,7 @@ describe('ActivityFeedCard', () => { test('should render an activity card', () => { const orderAdded = { ...orderAddedFixture } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -178,7 +179,7 @@ describe('ActivityFeedCard', () => { test('should render an activity card', () => { const companiesHouseAccountsDue = { ...companiesHouseAccountsDueFixture } const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) @@ -188,7 +189,7 @@ describe('ActivityFeedCard', () => { test('should render an activity card', () => { const companiesHouseCompanyIncorporated = { ...companiesHouseCompaniesFixture } const tree = renderer - .create() @@ -200,7 +201,7 @@ describe('ActivityFeedCard', () => { describe('when there is a HMRC Exporter record', () => { test('should render an activity card', () => { const tree = renderer - .create() + .create() .toJSON() expect(tree).toMatchSnapshot() }) diff --git a/src/activity-feed/ActivityFeed.test.jsx b/src/activity-feed/__tests__/ActivityFeed.test.jsx similarity index 94% rename from src/activity-feed/ActivityFeed.test.jsx rename to src/activity-feed/__tests__/ActivityFeed.test.jsx index 6c9e842b..d866b10e 100644 --- a/src/activity-feed/ActivityFeed.test.jsx +++ b/src/activity-feed/__tests__/ActivityFeed.test.jsx @@ -4,8 +4,8 @@ import { uniqueId } from 'lodash' import { mount } from 'enzyme' import { Details } from 'govuk-react' -import ActivityFeed from './ActivityFeed' -import interactionActivityFixture from '../../fixtures/activity_feed/interactions/interaction' +import ActivityFeed from '../ActivityFeed' +import interactionActivityFixture from '../__fixtures__/interactions/interaction' const generateActivities = total => Array.from({ length: total }, () => ({ diff --git a/src/activity-feed/ActivityFeedApp.test.jsx b/src/activity-feed/__tests__/ActivityFeedApp.test.jsx similarity index 88% rename from src/activity-feed/ActivityFeedApp.test.jsx rename to src/activity-feed/__tests__/ActivityFeedApp.test.jsx index 7fa76a86..bde87f94 100644 --- a/src/activity-feed/ActivityFeedApp.test.jsx +++ b/src/activity-feed/__tests__/ActivityFeedApp.test.jsx @@ -2,8 +2,8 @@ import React from 'react' import renderer from 'react-test-renderer' import nock from 'nock' -import ActivityFeedApp from './ActivityFeedApp' -import esResults from '../../fixtures/activity_feed/activity-feed-from-es' +import ActivityFeedApp from '../ActivityFeedApp' +import esResults from '../__fixtures__/activity-feed-from-es' describe('ActivityFeedApp', () => { test('fetches activity feed', async (done) => { diff --git a/src/activity-feed/ActivityFeedFilters.test.jsx b/src/activity-feed/__tests__/ActivityFeedFilters.test.jsx similarity index 96% rename from src/activity-feed/ActivityFeedFilters.test.jsx rename to src/activity-feed/__tests__/ActivityFeedFilters.test.jsx index 671e4a24..a0de8741 100644 --- a/src/activity-feed/ActivityFeedFilters.test.jsx +++ b/src/activity-feed/__tests__/ActivityFeedFilters.test.jsx @@ -2,7 +2,7 @@ import React from 'react' import renderer from 'react-test-renderer' import { shallow } from 'enzyme' -import ActivityFeedFilters from './ActivityFeedFilters' +import ActivityFeedFilters from '../ActivityFeedFilters' describe('ActivityFeedFilters', () => { describe('when the details for all activities are hidden', () => { diff --git a/src/activity-feed/ActivityFeedHeader.test.jsx b/src/activity-feed/__tests__/ActivityFeedHeader.test.jsx similarity index 93% rename from src/activity-feed/ActivityFeedHeader.test.jsx rename to src/activity-feed/__tests__/ActivityFeedHeader.test.jsx index c72f20a7..dd24b7b7 100644 --- a/src/activity-feed/ActivityFeedHeader.test.jsx +++ b/src/activity-feed/__tests__/ActivityFeedHeader.test.jsx @@ -1,7 +1,7 @@ import React from 'react' import renderer from 'react-test-renderer' -import ActivityFeedHeader from './ActivityFeedHeader' +import ActivityFeedHeader from '../ActivityFeedHeader' describe('ActivityFeedHeader', () => { test('renders header without props', () => { diff --git a/src/activity-feed/ActivityFeedPagination.test.jsx b/src/activity-feed/__tests__/ActivityFeedPagination.test.jsx similarity index 94% rename from src/activity-feed/ActivityFeedPagination.test.jsx rename to src/activity-feed/__tests__/ActivityFeedPagination.test.jsx index 343394a4..6ff2db16 100644 --- a/src/activity-feed/ActivityFeedPagination.test.jsx +++ b/src/activity-feed/__tests__/ActivityFeedPagination.test.jsx @@ -2,7 +2,7 @@ import React from 'react' import renderer from 'react-test-renderer' import { mount } from 'enzyme' -import ActivityFeedPagination from './ActivityFeedPagination' +import ActivityFeedPagination from '../ActivityFeedPagination' describe('ActivityFeedPagination', () => { test('renders default pagination', () => { diff --git a/src/activity-feed/__snapshots__/ActivityFeedCard.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/Activity.test.jsx.snap similarity index 98% rename from src/activity-feed/__snapshots__/ActivityFeedCard.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/Activity.test.jsx.snap index 626e5a2c..181a29ca 100644 --- a/src/activity-feed/__snapshots__/ActivityFeedCard.test.jsx.snap +++ b/src/activity-feed/__tests__/__snapshots__/Activity.test.jsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ActivityFeedCard when a New OMIS order is added should render an activity card 1`] = ` +exports[`Activity when a New OMIS order is added should render an activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -586,7 +586,7 @@ exports[`ActivityFeedCard when a New OMIS order is added should render an activi `; -exports[`ActivityFeedCard when an investment project is CTI should render the CTI investment project activity card 1`] = ` +exports[`Activity when an investment project is CTI should render the CTI investment project activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -1128,7 +1128,7 @@ exports[`ActivityFeedCard when an investment project is CTI should render the CT `; -exports[`ActivityFeedCard when an investment project is FDI should render the FDI investment project activity card 1`] = ` +exports[`Activity when an investment project is FDI should render the FDI investment project activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -1804,7 +1804,7 @@ exports[`ActivityFeedCard when an investment project is FDI should render the FD `; -exports[`ActivityFeedCard when an investment project is Non-FDI should render the Non-FDI investment project activity card 1`] = ` +exports[`Activity when an investment project is Non-FDI should render the Non-FDI investment project activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -2390,7 +2390,7 @@ exports[`ActivityFeedCard when an investment project is Non-FDI should render th `; -exports[`ActivityFeedCard when the interaction does not have a service should render interaction activity without services 1`] = ` +exports[`Activity when the interaction does not have a service should render interaction activity without services 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -2900,7 +2900,7 @@ exports[`ActivityFeedCard when the interaction does not have a service should re `; -exports[`ActivityFeedCard when the interaction is a draft and archived should render interaction activity with "Cancelled interaction" badge 1`] = ` +exports[`Activity when the interaction is a draft and archived should render interaction activity with "Cancelled interaction" badge 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -3533,7 +3533,7 @@ exports[`ActivityFeedCard when the interaction is a draft and archived should re `; -exports[`ActivityFeedCard when the interaction is a draft and upcoming should render interaction activity with "Upcoming interaction" badge 1`] = ` +exports[`Activity when the interaction is a draft and upcoming should render interaction activity with "Upcoming interaction" badge 1`] = ` .c0 { border: 1px dashed #bfc1c3; padding: 15px; @@ -4166,7 +4166,7 @@ exports[`ActivityFeedCard when the interaction is a draft and upcoming should re `; -exports[`ActivityFeedCard when the interaction is a draft in the past should render interaction activity with "Incomplete interaction" badge 1`] = ` +exports[`Activity when the interaction is a draft in the past should render interaction activity with "Incomplete interaction" badge 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -4799,7 +4799,7 @@ exports[`ActivityFeedCard when the interaction is a draft in the past should ren `; -exports[`ActivityFeedCard when the interaction is complete should render interaction activity with "Completed interaction" badge 1`] = ` +exports[`Activity when the interaction is complete should render interaction activity with "Completed interaction" badge 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -5432,7 +5432,7 @@ exports[`ActivityFeedCard when the interaction is complete should render interac `; -exports[`ActivityFeedCard when there is a Companies House Accounts record should render an activity card 1`] = ` +exports[`Activity when there is a Companies House Accounts record should render an activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -6021,7 +6021,7 @@ exports[`ActivityFeedCard when there is a Companies House Accounts record should `; -exports[`ActivityFeedCard when there is a Companies House Company incorporation record should render an activity card 1`] = ` +exports[`Activity when there is a Companies House Company incorporation record should render an activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -6604,7 +6604,7 @@ exports[`ActivityFeedCard when there is a Companies House Company incorporation `; -exports[`ActivityFeedCard when there is a HMRC Exporter record should render an activity card 1`] = ` +exports[`Activity when there is a HMRC Exporter record should render an activity card 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -7057,7 +7057,7 @@ exports[`ActivityFeedCard when there is a HMRC Exporter record should render an `; -exports[`ActivityFeedCard when there is a service delivery should render service delivery activity 1`] = ` +exports[`Activity when there is a service delivery should render service delivery activity 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -7627,9 +7627,9 @@ exports[`ActivityFeedCard when there is a service delivery should render service `; -exports[`ActivityFeedCard when there is an activity item of unknown type should not render an activity card 1`] = `null`; +exports[`Activity when there is an activity item of unknown type should not render an activity card 1`] = `null`; -exports[`ActivityFeedCard when there is an interaction should render interaction activity 1`] = ` +exports[`Activity when there is an interaction should render interaction activity 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; @@ -8262,7 +8262,7 @@ exports[`ActivityFeedCard when there is an interaction should render interaction `; -exports[`ActivityFeedCard when there is an interaction without any people involved should render interaction activity without advisers nor contacts 1`] = ` +exports[`Activity when there is an interaction without any people involved should render interaction activity without advisers nor contacts 1`] = ` .c0 { border: 1px solid #bfc1c3; padding: 15px; diff --git a/src/activity-feed/__snapshots__/ActivityFeed.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/ActivityFeed.test.jsx.snap similarity index 100% rename from src/activity-feed/__snapshots__/ActivityFeed.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/ActivityFeed.test.jsx.snap diff --git a/src/activity-feed/__snapshots__/ActivityFeedApp.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/ActivityFeedApp.test.jsx.snap similarity index 100% rename from src/activity-feed/__snapshots__/ActivityFeedApp.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/ActivityFeedApp.test.jsx.snap diff --git a/src/activity-feed/__snapshots__/ActivityFeedFilters.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/ActivityFeedFilters.test.jsx.snap similarity index 100% rename from src/activity-feed/__snapshots__/ActivityFeedFilters.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/ActivityFeedFilters.test.jsx.snap diff --git a/src/activity-feed/__snapshots__/ActivityFeedHeader.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/ActivityFeedHeader.test.jsx.snap similarity index 100% rename from src/activity-feed/__snapshots__/ActivityFeedHeader.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/ActivityFeedHeader.test.jsx.snap diff --git a/src/activity-feed/__snapshots__/ActivityFeedPagination.test.jsx.snap b/src/activity-feed/__tests__/__snapshots__/ActivityFeedPagination.test.jsx.snap similarity index 100% rename from src/activity-feed/__snapshots__/ActivityFeedPagination.test.jsx.snap rename to src/activity-feed/__tests__/__snapshots__/ActivityFeedPagination.test.jsx.snap diff --git a/src/activity-feed/activity-feed-cards/CompaniesHouseAccount.jsx b/src/activity-feed/cards/CompaniesHouseAccount.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/CompaniesHouseAccount.jsx rename to src/activity-feed/cards/CompaniesHouseAccount.jsx diff --git a/src/activity-feed/activity-feed-cards/CompaniesHouseCompany.jsx b/src/activity-feed/cards/CompaniesHouseCompany.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/CompaniesHouseCompany.jsx rename to src/activity-feed/cards/CompaniesHouseCompany.jsx diff --git a/src/activity-feed/activity-feed-cards/HmrcExporter.jsx b/src/activity-feed/cards/HmrcExporter.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/HmrcExporter.jsx rename to src/activity-feed/cards/HmrcExporter.jsx diff --git a/src/activity-feed/activity-feed-cards/Interaction.jsx b/src/activity-feed/cards/Interaction.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/Interaction.jsx rename to src/activity-feed/cards/Interaction.jsx diff --git a/src/activity-feed/activity-feed-cards/InteractionUtils.js b/src/activity-feed/cards/InteractionUtils.js similarity index 100% rename from src/activity-feed/activity-feed-cards/InteractionUtils.js rename to src/activity-feed/cards/InteractionUtils.js diff --git a/src/activity-feed/activity-feed-cards/InvestmentProject.jsx b/src/activity-feed/cards/InvestmentProject.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/InvestmentProject.jsx rename to src/activity-feed/cards/InvestmentProject.jsx diff --git a/src/activity-feed/activity-feed-cards/Omis.jsx b/src/activity-feed/cards/Omis.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/Omis.jsx rename to src/activity-feed/cards/Omis.jsx diff --git a/src/activity-feed/activity-feed-cards/README.md b/src/activity-feed/cards/README.md similarity index 57% rename from src/activity-feed/activity-feed-cards/README.md rename to src/activity-feed/cards/README.md index 6355701a..091bc55a 100644 --- a/src/activity-feed/activity-feed-cards/README.md +++ b/src/activity-feed/cards/README.md @@ -1,9 +1,9 @@ To add a card for a new activity type you will need to: - 1. Add a new `*.jsx` card component to this `~/src/activity-feed/activity-feed-cards` directory. To get started this could essentially be a copy of `Default.jsx`. + 1. Add a new `*.jsx` card component to this `~/src/activity-feed/cards` directory. To get started this could essentially be a copy of `Default.jsx`. 2. Modify the `static` `canRender` function to render the new card using a condition based on data from the activity item JSON. - 3. Add the new card to the array found in `~/src/activity-feed/activity-feed-cards/index.js`. Note that cards at the top of the array are treated with higher priority, hence `Default` is last. + 3. Add the new card to the array found in `~/src/activity-feed/cards/index.js`. Note that cards at the top of the array are treated with higher priority, hence `Default` is last. Your new card will now render when the condition in `canRender` has been met. - Ensure the tests in `~/src/ActivityFeedCard.test.jsx` are updated. + Ensure the tests in `~/src/Activity.test.jsx` are updated. diff --git a/src/activity-feed/activity-feed-cards/InteractionUtils.test.js b/src/activity-feed/cards/__tests__/InteractionUtils.test.js similarity index 98% rename from src/activity-feed/activity-feed-cards/InteractionUtils.test.js rename to src/activity-feed/cards/__tests__/InteractionUtils.test.js index 6837576e..bae5e795 100644 --- a/src/activity-feed/activity-feed-cards/InteractionUtils.test.js +++ b/src/activity-feed/cards/__tests__/InteractionUtils.test.js @@ -1,7 +1,7 @@ import { RED, GREEN, BLUE } from 'govuk-colours' import moment from 'moment' -import InteractionUtils from './InteractionUtils' +import InteractionUtils from '../InteractionUtils' describe('InteractionUtils.js', () => { describe('#transform', () => { diff --git a/src/activity-feed/activity-feed-cards/card/Card.jsx b/src/activity-feed/cards/card/Card.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/Card.jsx rename to src/activity-feed/cards/card/Card.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardDetails.jsx b/src/activity-feed/cards/card/CardDetails.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardDetails.jsx rename to src/activity-feed/cards/card/CardDetails.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardDetailsList.jsx b/src/activity-feed/cards/card/CardDetailsList.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardDetailsList.jsx rename to src/activity-feed/cards/card/CardDetailsList.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardHeader.jsx b/src/activity-feed/cards/card/CardHeader.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardHeader.jsx rename to src/activity-feed/cards/card/CardHeader.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardHeading.jsx b/src/activity-feed/cards/card/CardHeading.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardHeading.jsx rename to src/activity-feed/cards/card/CardHeading.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardHeadingBlock.jsx b/src/activity-feed/cards/card/CardHeadingBlock.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardHeadingBlock.jsx rename to src/activity-feed/cards/card/CardHeadingBlock.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardMeta.jsx b/src/activity-feed/cards/card/CardMeta.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardMeta.jsx rename to src/activity-feed/cards/card/CardMeta.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardTable.jsx b/src/activity-feed/cards/card/CardTable.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardTable.jsx rename to src/activity-feed/cards/card/CardTable.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardUtils.jsx b/src/activity-feed/cards/card/CardUtils.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/CardUtils.jsx rename to src/activity-feed/cards/card/CardUtils.jsx diff --git a/src/activity-feed/activity-feed-cards/card/CardDetails.test.jsx b/src/activity-feed/cards/card/__tests__/CardDetails.test.jsx similarity index 97% rename from src/activity-feed/activity-feed-cards/card/CardDetails.test.jsx rename to src/activity-feed/cards/card/__tests__/CardDetails.test.jsx index 9d8e1926..1af7235d 100644 --- a/src/activity-feed/activity-feed-cards/card/CardDetails.test.jsx +++ b/src/activity-feed/cards/card/__tests__/CardDetails.test.jsx @@ -1,6 +1,6 @@ import React from 'react' import renderer from 'react-test-renderer' -import CardDetails from './CardDetails' +import CardDetails from '../CardDetails' describe('CardDetails', () => { describe('when the details for all activities are hidden', () => { diff --git a/src/activity-feed/activity-feed-cards/card/CardHeading.test.jsx b/src/activity-feed/cards/card/__tests__/CardHeading.test.jsx similarity index 97% rename from src/activity-feed/activity-feed-cards/card/CardHeading.test.jsx rename to src/activity-feed/cards/card/__tests__/CardHeading.test.jsx index 35c8c5c8..613149a6 100644 --- a/src/activity-feed/activity-feed-cards/card/CardHeading.test.jsx +++ b/src/activity-feed/cards/card/__tests__/CardHeading.test.jsx @@ -1,6 +1,6 @@ import React from 'react' import renderer from 'react-test-renderer' -import CardHeading from './CardHeading' +import CardHeading from '../CardHeading' describe('CardHeading', () => { describe('when the all data items are passed', () => { diff --git a/src/activity-feed/activity-feed-cards/card/CardUtils.test.js b/src/activity-feed/cards/card/__tests__/CardUtils.test.js similarity index 97% rename from src/activity-feed/activity-feed-cards/card/CardUtils.test.js rename to src/activity-feed/cards/card/__tests__/CardUtils.test.js index f3eb997b..a026d635 100644 --- a/src/activity-feed/activity-feed-cards/card/CardUtils.test.js +++ b/src/activity-feed/cards/card/__tests__/CardUtils.test.js @@ -1,4 +1,4 @@ -import CardUtils from './CardUtils' +import CardUtils from '../CardUtils' describe('CardUtils.js', () => { describe('#canRenderByTypes', () => { diff --git a/src/activity-feed/activity-feed-cards/card/__snapshots__/CardDetails.test.jsx.snap b/src/activity-feed/cards/card/__tests__/__snapshots__/CardDetails.test.jsx.snap similarity index 100% rename from src/activity-feed/activity-feed-cards/card/__snapshots__/CardDetails.test.jsx.snap rename to src/activity-feed/cards/card/__tests__/__snapshots__/CardDetails.test.jsx.snap diff --git a/src/activity-feed/activity-feed-cards/card/__snapshots__/CardHeading.test.jsx.snap b/src/activity-feed/cards/card/__tests__/__snapshots__/CardHeading.test.jsx.snap similarity index 100% rename from src/activity-feed/activity-feed-cards/card/__snapshots__/CardHeading.test.jsx.snap rename to src/activity-feed/cards/card/__tests__/__snapshots__/CardHeading.test.jsx.snap diff --git a/src/activity-feed/activity-feed-cards/card/index.js b/src/activity-feed/cards/card/index.js similarity index 100% rename from src/activity-feed/activity-feed-cards/card/index.js rename to src/activity-feed/cards/card/index.js diff --git a/src/activity-feed/activity-feed-cards/card/item-renderers/AdviserItemRenderer.jsx b/src/activity-feed/cards/card/item-renderers/AdviserItemRenderer.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/item-renderers/AdviserItemRenderer.jsx rename to src/activity-feed/cards/card/item-renderers/AdviserItemRenderer.jsx diff --git a/src/activity-feed/activity-feed-cards/card/item-renderers/BooleanItemRenderer.jsx b/src/activity-feed/cards/card/item-renderers/BooleanItemRenderer.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/item-renderers/BooleanItemRenderer.jsx rename to src/activity-feed/cards/card/item-renderers/BooleanItemRenderer.jsx diff --git a/src/activity-feed/activity-feed-cards/card/item-renderers/ContactItemRenderer.jsx b/src/activity-feed/cards/card/item-renderers/ContactItemRenderer.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/item-renderers/ContactItemRenderer.jsx rename to src/activity-feed/cards/card/item-renderers/ContactItemRenderer.jsx diff --git a/src/activity-feed/activity-feed-cards/card/item-renderers/DefaultItemRenderer.jsx b/src/activity-feed/cards/card/item-renderers/DefaultItemRenderer.jsx similarity index 100% rename from src/activity-feed/activity-feed-cards/card/item-renderers/DefaultItemRenderer.jsx rename to src/activity-feed/cards/card/item-renderers/DefaultItemRenderer.jsx diff --git a/src/activity-feed/activity-feed-cards/card/item-renderers/index.js b/src/activity-feed/cards/card/item-renderers/index.js similarity index 100% rename from src/activity-feed/activity-feed-cards/card/item-renderers/index.js rename to src/activity-feed/cards/card/item-renderers/index.js diff --git a/src/activity-feed/activity-feed-cards/index.js b/src/activity-feed/cards/index.js similarity index 100% rename from src/activity-feed/activity-feed-cards/index.js rename to src/activity-feed/cards/index.js diff --git a/fixtures/Dashboard/companies.json b/src/dashboard/__fixtures__/companies.json similarity index 100% rename from fixtures/Dashboard/companies.json rename to src/dashboard/__fixtures__/companies.json diff --git a/src/dashboard/DashboardSection.stories.jsx b/src/dashboard/__stories__/DashboardSection.stories.jsx similarity index 75% rename from src/dashboard/DashboardSection.stories.jsx rename to src/dashboard/__stories__/DashboardSection.stories.jsx index 521e38b1..541b5b82 100644 --- a/src/dashboard/DashboardSection.stories.jsx +++ b/src/dashboard/__stories__/DashboardSection.stories.jsx @@ -1,9 +1,9 @@ import React from 'react' import { storiesOf } from '@storybook/react' import PropTypes from 'prop-types' -import useMyCompaniesContext from './my-companies/useMyCompaniesContext' -import MyCompaniesTile from './my-companies/MyCompaniesTile' -import allCompanies from '../../fixtures/Dashboard/companies.json' +import useMyCompaniesContext from '../my-companies/useMyCompaniesContext' +import MyCompaniesTile from '../my-companies/MyCompaniesTile' +import allCompanies from '../__fixtures__/companies.json' const MyCompaniesDashboardStory = ({ fixture }) => { return ( diff --git a/src/dashboard/DashboardSection.test.jsx b/src/dashboard/__tests__/DashboardSection.test.jsx similarity index 95% rename from src/dashboard/DashboardSection.test.jsx rename to src/dashboard/__tests__/DashboardSection.test.jsx index 849ea990..8a08e48f 100644 --- a/src/dashboard/DashboardSection.test.jsx +++ b/src/dashboard/__tests__/DashboardSection.test.jsx @@ -1,6 +1,6 @@ import React from 'react' import { mount } from 'enzyme' -import DashboardSection from './DashboardSection' +import DashboardSection from '../DashboardSection' const initialProps = { heading: 'My Companies', diff --git a/src/dashboard/__snapshots__/DashboardSection.test.jsx.snap b/src/dashboard/__tests__/__snapshots__/DashboardSection.test.jsx.snap similarity index 100% rename from src/dashboard/__snapshots__/DashboardSection.test.jsx.snap rename to src/dashboard/__tests__/__snapshots__/DashboardSection.test.jsx.snap diff --git a/src/dashboard/my-companies/__snapshots__/MyCompaniesFilters.test.jsx.snap b/src/dashboard/my-companies/__snapshots__/MyCompaniesFilters.test.jsx.snap deleted file mode 100644 index f2c1f174..00000000 --- a/src/dashboard/my-companies/__snapshots__/MyCompaniesFilters.test.jsx.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`MyCompaniesFilters renders company filters 1`] = ` -" - - - -
    - - - - - - - - - - - - Sort By: - - - - - - - - - - - - -
    -
    -
    -
    -
    " -`; diff --git a/src/dashboard/my-companies/__snapshots__/MyCompaniesTable.test.jsx.snap b/src/dashboard/my-companies/__snapshots__/MyCompaniesTable.test.jsx.snap deleted file mode 100644 index 215951d4..00000000 --- a/src/dashboard/my-companies/__snapshots__/MyCompaniesTable.test.jsx.snap +++ /dev/null @@ -1,72 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`MyCompaniesTable should match the snapshot 1`] = ` -" - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Company name - - Last interaction - -   -
    - - - -
    -
    " -`; diff --git a/src/dashboard/my-companies/__snapshots__/MyCompaniesTile.test.jsx.snap b/src/dashboard/my-companies/__snapshots__/MyCompaniesTile.test.jsx.snap deleted file mode 100644 index 71ab0332..00000000 --- a/src/dashboard/my-companies/__snapshots__/MyCompaniesTile.test.jsx.snap +++ /dev/null @@ -1,309 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`My companies dashboard should match the snapshot 1`] = ` -" - - - - -
    - - -
    - - - -

    - My Companies -

    -
    -
    -
    -
    - - - -
    - - - - - - - - - - - - Sort By: - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Company name - - Last interaction - -   -
    - - - - -
    - A1 BMW LTD!!!!! - -
    -
    -
    -
    -
    -
    - 14 Aug 19 - - - - - -
    - Here is a long interaction title some more text some more text some more text almost finished some more text nearly there more text finished - -
    -
    -
    -
    -
    -
    - - - - -
    - Portable Potatoes - -
    -
    -
    -
    -
    -
    - - - - No interactions have been recorded -
    - - - - -
    - Zebra clothing - -
    -
    -
    -
    -
    -
    - 21 Feb 2019 - - - - - -
    - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - -
    -
    -
    -
    -
    -
    - - - -
    - - -
    - - -
    - - - - - - - How do I remove a company from this list - - - - - - - - -
    - You can remove a company from your list in the company's page. -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    " -`; diff --git a/src/dashboard/my-companies/MyCompaniesFilters.test.jsx b/src/dashboard/my-companies/__tests__/MyCompaniesFilters.test.jsx similarity index 89% rename from src/dashboard/my-companies/MyCompaniesFilters.test.jsx rename to src/dashboard/my-companies/__tests__/MyCompaniesFilters.test.jsx index cfeb6efe..fe97d154 100644 --- a/src/dashboard/my-companies/MyCompaniesFilters.test.jsx +++ b/src/dashboard/my-companies/__tests__/MyCompaniesFilters.test.jsx @@ -1,7 +1,7 @@ import React from 'react' import { mount } from 'enzyme' -import MyCompaniesFilters from './MyCompaniesFilters' -import useMyCompaniesContext from './useMyCompaniesContext' +import MyCompaniesFilters from '../MyCompaniesFilters' +import useMyCompaniesContext from '../useMyCompaniesContext' describe('MyCompaniesFilters', () => { const mockDispatch = jest.fn() @@ -11,7 +11,7 @@ describe('MyCompaniesFilters', () => { , ) - expect(wrapper.debug()).toMatchSnapshot() + expect(wrapper).toMatchSnapshot() }) describe('Select', () => { diff --git a/src/dashboard/my-companies/MyCompaniesTable.test.jsx b/src/dashboard/my-companies/__tests__/MyCompaniesTable.test.jsx similarity index 58% rename from src/dashboard/my-companies/MyCompaniesTable.test.jsx rename to src/dashboard/my-companies/__tests__/MyCompaniesTable.test.jsx index 02a6d418..cd0d49d2 100644 --- a/src/dashboard/my-companies/MyCompaniesTable.test.jsx +++ b/src/dashboard/my-companies/__tests__/MyCompaniesTable.test.jsx @@ -1,8 +1,8 @@ import React from 'react' import { mount } from 'enzyme' -import MyCompaniesTable from './MyCompaniesTable' -import useMyCompaniesContext from './useMyCompaniesContext' -import companies from '../../../fixtures/Dashboard/companies' +import MyCompaniesTable from '../MyCompaniesTable' +import useMyCompaniesContext from '../useMyCompaniesContext' +import companies from '../../__fixtures__/companies' describe('MyCompaniesTable', () => { test('should match the snapshot', () => { @@ -11,6 +11,6 @@ describe('MyCompaniesTable', () => { , ) - expect(wrapper.debug()).toMatchSnapshot() + expect(wrapper).toMatchSnapshot() }) }) diff --git a/src/dashboard/my-companies/MyCompaniesTile.test.jsx b/src/dashboard/my-companies/__tests__/MyCompaniesTile.test.jsx similarity index 93% rename from src/dashboard/my-companies/MyCompaniesTile.test.jsx rename to src/dashboard/my-companies/__tests__/MyCompaniesTile.test.jsx index 59ebb26a..9bdb326a 100644 --- a/src/dashboard/my-companies/MyCompaniesTile.test.jsx +++ b/src/dashboard/my-companies/__tests__/MyCompaniesTile.test.jsx @@ -1,8 +1,8 @@ import React from 'react' import { mount } from 'enzyme' -import MyCompaniesTile from './MyCompaniesTile' -import useMyCompaniesContext from './useMyCompaniesContext' -import companies from '../../../fixtures/Dashboard/companies' +import MyCompaniesTile from '../MyCompaniesTile' +import useMyCompaniesContext from '../useMyCompaniesContext' +import companies from '../../__fixtures__/companies' describe('My companies dashboard', () => { test('should match the snapshot', () => { @@ -11,7 +11,7 @@ describe('My companies dashboard', () => { , ) - expect(wrapper.debug()).toMatchSnapshot() + expect(wrapper).toMatchSnapshot() }) describe('when there are a list of companies', () => { const wrapper = mount( diff --git a/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesFilters.test.jsx.snap b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesFilters.test.jsx.snap new file mode 100644 index 00000000..ff580531 --- /dev/null +++ b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesFilters.test.jsx.snap @@ -0,0 +1,415 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`MyCompaniesFilters renders company filters 1`] = ` +.c3 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + display: block; + clear: none; + padding-bottom: 2px; + margin-bottom: 0; +} + +.c4 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + box-sizing: border-box; + width: 100%; + height: 33px; + padding: 5px 4px 4px; + border: 2px solid #0b0c0c; + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; +} + +.c4:focus { + outline: 3px solid #ffbf47; + outline-offset: 0; +} + +.c2 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; +} + +.c0 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + -ms-flex-pack: justify; + justify-content: space-between; +} + +.c1 { + margin-right: 10px; + padding-right: 5px; + padding-left: 5px; +} + +@media print { + .c3 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c3 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c3 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c3 { + margin-bottom: 0; + } +} + +@media print { + .c4 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c4 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media only screen and (min-width:641px) { + .c4 { + width: 50%; + height: 38px; + } +} + +@media print { + .c4 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c4 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media only screen and (min-width:641px) { + .c4 { + width: auto; + } +} + +@media print { + .c2 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c2 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + + + + + +
    + + , + } + } + onChange={[Function]} + placeholder="Search list" + type="text" + value="" + > + + + + + + + + + + Sort By: + + + + + + + + + + + + +
    +
    +
    +
    +
    +`; diff --git a/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTable.test.jsx.snap b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTable.test.jsx.snap new file mode 100644 index 00000000..d8758114 --- /dev/null +++ b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTable.test.jsx.snap @@ -0,0 +1,551 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`MyCompaniesTable should match the snapshot 1`] = ` +.c2 { + padding: 10px 20px 10px 0; + border-bottom: 1px solid #bfc1c3; + text-align: left; + font-weight: 700; +} + +.c2:last-child { + padding-right: 0; +} + +.c0 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + width: 100%; + border-spacing: 0; + border-collapse: collapse; + margin-bottom: 20px; +} + +.c1 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 700; + font-size: 12px; + line-height: 1.25; +} + +@media print { + .c0 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c0 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c0 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c0 { + margin-bottom: 30px; + } +} + +@media print { + .c1 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c1 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media only screen and (min-width:769px) { + .c1 { + overflow: hidden; + white-space: nowrap; + } +} + + + + + + Company name + + + Last interaction + + +   + + + } + > + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Company name + + Last interaction + +   +
    + + + +
    +
    +`; diff --git a/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTile.test.jsx.snap b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTile.test.jsx.snap new file mode 100644 index 00000000..e9aee61f --- /dev/null +++ b/src/dashboard/my-companies/__tests__/__snapshots__/MyCompaniesTile.test.jsx.snap @@ -0,0 +1,2513 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`My companies dashboard should match the snapshot 1`] = ` +.c14 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + margin-bottom: 20px; + display: block; +} + +.c15 { + display: inline-block; + position: relative; + margin-bottom: 5px; + padding-left: 25px; + color: #005ea5; + cursor: pointer; +} + +.c15:hover { + color: #2b8cc4; +} + +.c15:focus { + outline: 4px solid #ffbf47; + outline-offset: -1px; + color: #0b0c0c; + background: #ffbf47; +} + +.c15::-webkit-details-marker { + display: none; +} + +.c15:before { + content: ""; + position: absolute; + top: 0; + bottom: 0; + left: 0; + margin: auto; + display: block; + width: 0; + height: 0; + border-style: solid; + border-color: transparent; + -webkit-clip-path: polygon(0% 0%,100% 50%,0% 100%); + clip-path: polygon(0% 0%,100% 50%,0% 100%); + border-width: 7px 0 7px 12.124px; + border-left-color: inherit; +} + +[open] > .c15:before { + display: block; + width: 0; + height: 0; + border-style: solid; + border-color: transparent; + -webkit-clip-path: polygon(0% 0%,50% 100%,100% 0%); + clip-path: polygon(0% 0%,50% 100%,100% 0%); + border-width: 12.124px 7px 0 7px; + border-top-color: inherit; +} + +.c16 { + -webkit-text-decoration: underline; + text-decoration: underline; +} + +.c17 { + padding: 15px; + padding-left: 20px; + border-left: 5px solid #bfc1c3; +} + +.c17 p { + margin-top: 0; + margin-bottom: 20px; +} + +.c17 > :last-child, +.c17 p:last-child { + margin-bottom: 0; +} + +.c2 { + font-size: 20px; + font-weight: bold; +} + +.c0 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + width: 100%; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + border-top: 4px solid #bfc1c3; + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; +} + +.c1 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + -ms-flex-pack: justify; + justify-content: space-between; + padding-top: 15px; +} + +.c6 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + display: block; + clear: none; + padding-bottom: 2px; + margin-bottom: 0; +} + +.c7 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + box-sizing: border-box; + width: 100%; + height: 33px; + padding: 5px 4px 4px; + border: 2px solid #0b0c0c; + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; +} + +.c7:focus { + outline: 3px solid #ffbf47; + outline-offset: 0; +} + +.c5 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; +} + +.c3 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + -ms-flex-pack: justify; + justify-content: space-between; +} + +.c4 { + margin-right: 10px; + padding-right: 5px; + padding-left: 5px; +} + +.c10 { + padding: 10px 20px 10px 0; + border-bottom: 1px solid #bfc1c3; + text-align: left; + font-weight: 700; +} + +.c10:last-child { + padding-right: 0; +} + +.c11 { + padding: 10px 20px 10px 0; + border-bottom: 1px solid #bfc1c3; + text-align: left; +} + +.c11:last-child { + padding-right: 0; +} + +.c8 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + width: 100%; + border-spacing: 0; + border-collapse: collapse; + margin-bottom: 20px; +} + +.c12 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.c12:link { + color: #005ea5; +} + +.c12:visited { + color: #4c2c92; +} + +.c12:hover { + color: #2b8cc4; +} + +.c12:active { + color: #2b8cc4; +} + +.c12:focus { + color: #0b0c0c; +} + +.c12:focus { + outline: 3px solid #ffbf47; + outline-offset: 0; + background-color: #ffbf47; +} + +.c9 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 700; + font-size: 12px; + line-height: 1.25; +} + +.c13 { + padding: 10px 20px 10px 0; + border-bottom: 1px solid #bfc1c3; + text-align: left; + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 12px; + line-height: 1.25; + color: #6f777b; + text-align: center; +} + +.c13:last-child { + padding-right: 0; +} + +@media print { + .c14 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c14 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c14 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c14 { + margin-bottom: 30px; + } +} + +@media print { + .c0 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c0 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media print { + .c6 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c6 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c6 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c6 { + margin-bottom: 0; + } +} + +@media print { + .c7 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c7 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media only screen and (min-width:641px) { + .c7 { + width: 50%; + height: 38px; + } +} + +@media print { + .c7 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c7 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media only screen and (min-width:641px) { + .c7 { + width: auto; + } +} + +@media print { + .c5 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c5 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media print { + .c8 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c8 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c8 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c8 { + margin-bottom: 30px; + } +} + +@media print { + .c12 { + font-family: sans-serif; + } +} + +@media print { + .c12[href^="/"]::after, + .c12[href^="http://"]::after, + .c12[href^="https://"]::after { + content: " (" attr(href) ")"; + font-size: 90%; + word-wrap: break-word; + } +} + +@media print { + .c9 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c9 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + +@media only screen and (min-width:769px) { + .c9 { + overflow: hidden; + white-space: nowrap; + } +} + +@media print { + .c13 { + font-size: 12px; + line-height: 1.2; + } +} + +@media only screen and (min-width:641px) { + .c13 { + font-size: 14px; + line-height: 1.4285714285714286; + } +} + + + + } + showSubHeading={false} + subHeading={ + + You have not added any companies to your list. +
    + You can add companies to this list from a company page, and only you can see this list. +
    + } + > + + +
    + + +
    + + + +

    + My Companies +

    +
    +
    +
    +
    + + + +
    + + , + } + } + onChange={[Function]} + placeholder="Search list" + type="text" + value="" + > + + + + + + + + + + Sort By: + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + + + + Company name + + + Last interaction + + +   + + + } + > + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Company name + + Last interaction + +   +
    + + + + +
    + A1 BMW LTD!!!!! + +
    +
    +
    +
    +
    +
    + 14 Aug 19 + + + + + +
    + Here is a long interaction title some more text some more text some more text almost finished some more text nearly there more text finished + +
    +
    +
    +
    +
    +
    + + + + +
    + Portable Potatoes + +
    +
    +
    +
    +
    +
    + - + + No interactions have been recorded +
    + + + + +
    + Zebra clothing + +
    +
    +
    +
    +
    +
    + 21 Feb 2019 + + + + + +
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + +
    +
    +
    +
    +
    +
    + + + +
    + + +
    + + +
    + + & { + display: block; width: 0; height: 0; border-style: solid; border-color: transparent; clip-path: polygon(0% 0%, 50% 100%, 100% 0%); border-width: 12.124px 7px 0 7px; border-top-color: inherit; +} +}", + ], + }, + "displayName": "styled.summary", + "foldedComponentIds": Array [], + "render": [Function], + "styledComponentId": "sc-bwzfXH", + "target": "summary", + "toString": [Function], + "warnTooManyClasses": [Function], + "withComponent": [Function], + } + } + forwardedRef={null} + > + + + + + How do I remove a company from this list + + + + + + + + :last-child, p:last-child { + margin-bottom: 0; +}", + ], + }, + "displayName": "styled.div", + "foldedComponentIds": Array [], + "render": [Function], + "styledComponentId": "sc-bxivhb", + "target": "div", + "toString": [Function], + "warnTooManyClasses": [Function], + "withComponent": [Function], + } + } + forwardedRef={null} + > +
    + You can remove a company from your list in the company's page. +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +`; diff --git a/src/dashboard/my-companies/__snapshots__/useMyCompaniesContext.test.jsx.snap b/src/dashboard/my-companies/__tests__/__snapshots__/useMyCompaniesContext.test.jsx.snap similarity index 81% rename from src/dashboard/my-companies/__snapshots__/useMyCompaniesContext.test.jsx.snap rename to src/dashboard/my-companies/__tests__/__snapshots__/useMyCompaniesContext.test.jsx.snap index 3a3bdd1c..058c71a8 100644 --- a/src/dashboard/my-companies/__snapshots__/useMyCompaniesContext.test.jsx.snap +++ b/src/dashboard/my-companies/__tests__/__snapshots__/useMyCompaniesContext.test.jsx.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Store useMyCompaniesContext() Provider matches snapshot 1`] = `""`; +exports[`Store useMyCompaniesContext() Provider matches snapshot 1`] = ``; diff --git a/src/dashboard/my-companies/useMyCompaniesContext.test.jsx b/src/dashboard/my-companies/__tests__/useMyCompaniesContext.test.jsx similarity index 97% rename from src/dashboard/my-companies/useMyCompaniesContext.test.jsx rename to src/dashboard/my-companies/__tests__/useMyCompaniesContext.test.jsx index 439b2902..fc7798bf 100644 --- a/src/dashboard/my-companies/useMyCompaniesContext.test.jsx +++ b/src/dashboard/my-companies/__tests__/useMyCompaniesContext.test.jsx @@ -5,8 +5,8 @@ import useMyCompaniesContext, { reducer, filterCompanyName, getModel, -} from './useMyCompaniesContext' -import companies from '../../../fixtures/Dashboard/companies' +} from '../useMyCompaniesContext' +import companies from '../../__fixtures__/companies' describe('Store', () => { describe('getModel()', () => { @@ -204,7 +204,7 @@ describe('Store', () => { describe('useMyCompaniesContext()', () => { test('Provider matches snapshot', () => { const wrapper = mount() - expect(wrapper.debug()).toMatchSnapshot() + expect(wrapper).toMatchSnapshot() }) }) }) diff --git a/src/entity-search/EntitySearch.stories.jsx b/src/entity-search/__stories__/EntitySearch.stories.jsx similarity index 83% rename from src/entity-search/EntitySearch.stories.jsx rename to src/entity-search/__stories__/EntitySearch.stories.jsx index a702407c..94c7afbe 100644 --- a/src/entity-search/EntitySearch.stories.jsx +++ b/src/entity-search/__stories__/EntitySearch.stories.jsx @@ -1,13 +1,14 @@ import React from 'react' import { storiesOf } from '@storybook/react' +import { action } from '@storybook/addon-actions' import { GridCol, GridRow, Main, H2 } from 'govuk-react' import { SPACING } from '@govuk-react/constants' import PropTypes from 'prop-types' -import { setupSuccessMocks, setupErrorMocks, setupNoResultsMocks } from './__mocks__/company-search' -import dataHubAddCompany from '../../assets/images/data-hub-add-company.png' -import dnbCompanySearchDataProvider from './data-providers/DnbCompanySearch' -import EntitySearchWithDataProvider from './EntitySearchWithDataProvider' +import { setupSuccessMocks, setupErrorMocks, setupNoResultsMocks } from '../__mocks__/company-search' +import dataHubAddCompanyBackground from './images/data-hub-add-company.png' +import dnbCompanySearchDataProvider from '../data-providers/DnbCompanySearch' +import EntitySearchWithDataProvider from '../EntitySearchWithDataProvider' const apiEndpoint = 'http://localhost:3010/v4/dnb/company-search' @@ -16,7 +17,7 @@ const EntitySearchForStorybook = ({ previouslySelected, cannotFindLink }) => {
    - Data Hub + Data Hub @@ -52,7 +53,7 @@ const EntitySearchForStorybook = ({ previouslySelected, cannotFindLink }) => { }} onEntityClick={(entity) => { if (!entity.datahub_company) { - alert(`Selected ${JSON.stringify(entity)}`) + action('EntitySearchWithDataProvider.onEntityClick')(entity) } }} /> @@ -97,9 +98,7 @@ storiesOf('EntitySearch', module) { - alert('Still cannot find :(') - }, + onClick: action('EntitySearchForStorybook.onClick'), }} /> ) @@ -111,7 +110,7 @@ storiesOf('EntitySearch', module) alert('Change previously selected'), + onChangeClick: action('EntitySearchForStorybook.onChangeClick'), }} /> ) diff --git a/assets/images/data-hub-add-company.png b/src/entity-search/__stories__/images/data-hub-add-company.png similarity index 100% rename from assets/images/data-hub-add-company.png rename to src/entity-search/__stories__/images/data-hub-add-company.png diff --git a/src/entity-search/EntitySearch.test.jsx b/src/entity-search/__tests__/EntitySearch.test.jsx similarity index 96% rename from src/entity-search/EntitySearch.test.jsx rename to src/entity-search/__tests__/EntitySearch.test.jsx index b5cf792b..3a727f6b 100644 --- a/src/entity-search/EntitySearch.test.jsx +++ b/src/entity-search/__tests__/EntitySearch.test.jsx @@ -2,10 +2,10 @@ import React from 'react' import { mount } from 'enzyme' import { act } from 'react-dom/test-utils' -import { setupSuccessMocks, setupErrorMocks, setupNoResultsMocks } from './__mocks__/company-search' -import fixtures from './__fixtures__' -import getEntities from './data-providers/DnbCompanySearch' -import EntitySearchWithDataProvider from './EntitySearchWithDataProvider' +import { setupSuccessMocks, setupErrorMocks, setupNoResultsMocks } from '../__mocks__/company-search' +import fixtures from '../__fixtures__' +import getEntities from '../data-providers/DnbCompanySearch' +import EntitySearchWithDataProvider from '../EntitySearchWithDataProvider' const API_ENDPOINT = 'http://localhost:8000/v4/dnb/company-search' @@ -21,7 +21,7 @@ const wrapEntitySearch = ({ url: 'http://stillcannotfind.com', text: 'still cannot find', }, - onEntityClick = () => console.log('entity clicked'), + onEntityClick = () => {}, } = {}) => { return mount( { }) test('should render the component with the error and without results', () => { - expect(wrappedEntitySearch.debug()).toMatchSnapshot() + expect(wrappedEntitySearch).toMatchSnapshot() }) }) @@ -377,7 +377,7 @@ describe('EntitySearch', () => { }) test('should render the component with the results and without the error', () => { - expect(wrappedEntitySearch.debug()).toMatchSnapshot() + expect(wrappedEntitySearch).toMatchSnapshot() }) }) }) diff --git a/src/entity-search/__snapshots__/EntitySearch.test.jsx.snap b/src/entity-search/__tests__/__snapshots__/EntitySearch.test.jsx.snap similarity index 83% rename from src/entity-search/__snapshots__/EntitySearch.test.jsx.snap rename to src/entity-search/__tests__/__snapshots__/EntitySearch.test.jsx.snap index e7ba34f5..70dcb4bc 100644 --- a/src/entity-search/__snapshots__/EntitySearch.test.jsx.snap +++ b/src/entity-search/__tests__/__snapshots__/EntitySearch.test.jsx.snap @@ -1,41 +1,735 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EntitySearch when at first there are results and then on second click there is an error should render the component with the error and without results 1`] = ` -" - - +.c10 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 19px; + box-sizing: border-box; + display: inline-block; + position: relative; + width: 100%; + margin-top: 0; + padding: 7px 10px; + border: 2px solid transparent; + border-radius: 0; + color: #ffffff; + background-color: #00823b; + box-shadow: 0 2px 0 #003618; + text-align: center; + vertical-align: top; + cursor: pointer; + -webkit-appearance: none; + margin-bottom: 22px; +} + +.c10:focus { + outline: 3px solid #ffbf47; + outline-offset: 0; +} + +.c10:link, +.c10:visited, +.c10:active, +.c10:hover { + color: #ffffff; + -webkit-text-decoration: none; + text-decoration: none; +} + +.c10::-moz-focus-inner { + padding: 0; + border: 0; +} + +.c10:hover, +.c10:focus { + background-color: #00692f; +} + +.c10:active { + top: 2px; + box-shadow: none; +} + +.c10::before { + content: ""; + display: block; + position: absolute; + top: -2px; + right: -2px; + bottom: -4px; + left: -2px; + background: transparent; +} + +.c10:active::before { + top: -4px; +} + +.c10:disabled { + opacity: 0.5; + background: #00823b; +} + +.c10:disabled:hover { + background-color: #00823b; + cursor: default; +} + +.c10:disabled:focus { + outline: none; +} + +.c10:disabled:active { + top: 0; + box-shadow: 0 2px 0 #003618; +} + +.c10 svg { + max-width: 15px; +} + +.c7 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + box-sizing: border-box; + width: 100%; + height: 40px; + margin-top: 0; + padding: 5px; + border: 2px solid #0b0c0c; + border-radius: 0; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + margin-bottom: 0; +} + +.c7:focus { + outline: 3px solid #ffbf47; + outline-offset: 0; +} + +.c7::-webkit-outer-spin-button, +.c7::-webkit-inner-spin-button { + margin: 0; + -webkit-appearance: none; +} + +.c7[type="number"] { + -moz-appearance: textfield; +} + +.c5 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + box-sizing: border-box; + margin-bottom: 0; +} + +.c5:after { + content: ''; + display: table; + clear: both; +} + +.c4 { + box-sizing: border-box; + padding-right: 15px; + padding-left: 15px; +} + +.c8 { + box-sizing: border-box; + padding-right: 15px; + padding-left: 15px; +} + +.c3 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + margin: 0 -15px; +} + +.c6 { + font-family: "nta",Arial,sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 400; + font-size: 16px; + line-height: 1.25; + color: #0b0c0c; + display: block; + clear: none; + padding-bottom: 2px; + margin-bottom: 0; +} + +.c0 { + background-color: #dee0e2; + padding: 10px; +} + +.c2 + .c1 { + margin-top: 15px; +} + +.c9 { + margin: 10px 0; +} + +@media print { + .c10 { + font-size: 14px; + line-height: 19px; + } +} + +@media only screen and (min-width:641px) { + .c10 { + font-size: 19px; + line-height: 19px; + } +} + +@media only screen and (min-width:641px) { + .c10 { + width: auto; + } +} + +@media only screen and (min-width:641px) { + .c10 svg { + margin-left: 10px; + } +} + +@media only screen and (min-width:641px) { + .c10 { + margin-bottom: 32px; + } +} + +@media print { + .c7 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c7 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media only screen and (min-width:641px) { + .c7 { + margin-bottom: 0; + } +} + +@media only screen and (min-width:641px) { + .c5 { + margin-bottom: 0; + } +} + +@media only screen and (min-width:641px) { + .c4 { + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + -ms-flex-positive: 1; + flex-grow: 1; + -webkit-flex-shrink: 1; + -ms-flex-negative: 1; + flex-shrink: 1; + } +} + +@media only screen and (min-width:641px) { + .c8 { + width: 50%; + -webkit-box-flex: 0; + -webkit-flex-grow: 0; + -ms-flex-positive: 0; + flex-grow: 0; + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; + } +} + +@media only screen and (min-width:641px) { + .c3 { + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + } +} + +@media print { + .c6 { + font-size: 14px; + line-height: 1.15; + } +} + +@media only screen and (min-width:641px) { + .c6 { + font-size: 19px; + line-height: 1.3157894736842106; + } +} + +@media print { + .c6 { + color: #000; + } +} + +@media only screen and (min-width:641px) { + .c6 { + margin-bottom: 0; + } +} + + + + - -
    - - - - - -
    - - - -
    - - -