diff --git a/src/components/FilterPanel/__snapshots__/FilterPanel.test.js.snap b/src/components/FilterPanel/__snapshots__/FilterPanel.test.js.snap index f25c5d6d..d2660d12 100644 --- a/src/components/FilterPanel/__snapshots__/FilterPanel.test.js.snap +++ b/src/components/FilterPanel/__snapshots__/FilterPanel.test.js.snap @@ -3,13 +3,13 @@ exports[`FilterPanel matches snapshot 1`] = `

Filters

- See studios - - + X - + `; diff --git a/src/components/ListingCard/__snapshots__/ListingCard.test.js.snap b/src/components/ListingCard/__snapshots__/ListingCard.test.js.snap index da9b2dab..ecfaf4ae 100644 --- a/src/components/ListingCard/__snapshots__/ListingCard.test.js.snap +++ b/src/components/ListingCard/__snapshots__/ListingCard.test.js.snap @@ -1,5 +1,5 @@ exports[`ListingCard matches snapshot 1`] = ` - - + `; diff --git a/src/components/ManageListingCard/__snapshots__/ManageListingCard.test.js.snap b/src/components/ManageListingCard/__snapshots__/ManageListingCard.test.js.snap index c128a6d9..1ce783f6 100644 --- a/src/components/ManageListingCard/__snapshots__/ManageListingCard.test.js.snap +++ b/src/components/ManageListingCard/__snapshots__/ManageListingCard.test.js.snap @@ -1,5 +1,5 @@ exports[`ManageListingCard matches snapshot 1`] = ` - - + `; diff --git a/src/components/MapPanel/__snapshots__/MapPanel.test.js.snap b/src/components/MapPanel/__snapshots__/MapPanel.test.js.snap index 96d8ea82..6f63cef7 100644 --- a/src/components/MapPanel/__snapshots__/MapPanel.test.js.snap +++ b/src/components/MapPanel/__snapshots__/MapPanel.test.js.snap @@ -4,13 +4,13 @@ exports[`MapPanel matches snapshot 1`] = ` Map
- Filters - - + X - +
`; diff --git a/src/components/NamedLink/NamedLink.js b/src/components/NamedLink/NamedLink.js index 199a640e..c97cdb4f 100644 --- a/src/components/NamedLink/NamedLink.js +++ b/src/components/NamedLink/NamedLink.js @@ -20,17 +20,15 @@ import React, { PropTypes } from 'react'; import { Link, withRouter } from 'react-router-dom'; import classNames from 'classnames'; +import routeConfiguration from '../../routeConfiguration'; import { pathByRouteName } from '../../util/routes'; -import { withFlattenedRoutes } from '../../util/contextHelpers'; -import * as propTypes from '../../util/propTypes'; export const NamedLinkComponent = props => { - const { name, params, flattenedRoutes, title } = props; + const { name, params, title } = props; // Link props const { to, children } = props; - - const pathname = pathByRouteName(name, flattenedRoutes, params); + const pathname = pathByRouteName(name, routeConfiguration(), params); const { match } = props; const active = match.url && match.url === pathname; @@ -45,7 +43,7 @@ export const NamedLinkComponent = props => { return {children}; }; -const { arrayOf, object, string, shape, any } = PropTypes; +const { object, string, shape, any } = PropTypes; NamedLinkComponent.defaultProps = { params: {}, @@ -76,11 +74,11 @@ NamedLinkComponent.propTypes = { activeClassName: string, title: string, - // from withFlattenedRoutes - flattenedRoutes: arrayOf(propTypes.route).isRequired, - // from withRouter match: object, }; -export default withFlattenedRoutes(withRouter(NamedLinkComponent)); +const NamedLink = withRouter(NamedLinkComponent); +NamedLink.displayName = 'NamedLink'; + +export default NamedLink; diff --git a/src/components/NamedLink/NamedLink.test.js b/src/components/NamedLink/NamedLink.test.js index 55ab0e3d..18edf007 100644 --- a/src/components/NamedLink/NamedLink.test.js +++ b/src/components/NamedLink/NamedLink.test.js @@ -1,33 +1,27 @@ import React from 'react'; -import { RoutesProvider } from '../index'; import { renderShallow, renderDeep } from '../../util/test-helpers'; import NamedLink, { NamedLinkComponent } from './NamedLink'; describe('NamedLinkComponent', () => { it('should mark the link as active if the current URL matches', () => { - const routesConf = [ - { path: '/a', name: 'APage', component: () => null }, - { path: '/b', name: 'BPage', component: () => null }, - ]; const activeClassName = 'my-active-class'; - const aProps = { - name: 'APage', + const landingPageProps = { + name: 'LandingPage', activeClassName, - flattenedRoutes: routesConf, - match: { url: '/a' }, + match: { url: '/' }, }; - const bProps = { - name: 'BPage', + const searchPageProps = { + name: 'SearchPage', activeClassName, - flattenedRoutes: routesConf, - match: { url: '/a' }, + match: { url: '/' }, }; const tree = renderDeep(
- link to a - link to b + link to a + link to b
); + const aLink = tree.children[0]; const bLink = tree.children[1]; expect(aLink.type).toEqual('a'); @@ -40,16 +34,11 @@ describe('NamedLinkComponent', () => { describe('NamedLink', () => { it('should contain correct link', () => { const id = 12; - const routesConf = [ - { path: '/somepage/:id', name: 'SomePage', component: () =>
blaa
}, - ]; const tree = renderDeep( - - to SomePage - + to ListingPage ); expect(tree.type).toEqual('a'); - expect(tree.props.href).toEqual(`/somepage/${id}`); - expect(tree.children).toEqual(['to SomePage']); + expect(tree.props.href).toEqual(`/l/${id}`); + expect(tree.children).toEqual(['to ListingPage']); }); }); diff --git a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap index 56ef5ad2..647e5804 100644 --- a/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap +++ b/src/components/OrderDetailsPanel/__snapshots__/OrderDetailsPanel.test.js.snap @@ -60,7 +60,7 @@ exports[`OrderDetailsPanel accepted matches snapshot 1`] = ` id="OrderDetailsPanel.orderAcceptedSubtitle" values={ Object { - "listingLink": listing1 title - , + , } } /> @@ -452,7 +452,7 @@ exports[`OrderDetailsPanel autorejected matches snapshot 1`] = ` id="OrderDetailsPanel.orderAutoRejectedTitle" values={ Object { - "listingLink": listing1 title - , + , } } /> @@ -853,7 +853,7 @@ exports[`OrderDetailsPanel canceled matches snapshot 1`] = ` id="OrderDetailsPanel.orderPreauthorizedSubtitle" values={ Object { - "listingLink": listing1 title - , + , } } /> @@ -1238,7 +1238,7 @@ exports[`OrderDetailsPanel delivered matches snapshot 1`] = ` id="OrderDetailsPanel.orderDeliveredTitle" values={ Object { - "listingLink": listing1 title - , + , } } /> @@ -1639,7 +1639,7 @@ exports[`OrderDetailsPanel preauthorized matches snapshot 1`] = ` id="OrderDetailsPanel.orderPreauthorizedSubtitle" values={ Object { - "listingLink": listing1 title - , + , } } /> @@ -2024,7 +2024,7 @@ exports[`OrderDetailsPanel rejected matches snapshot 1`] = ` id="OrderDetailsPanel.orderRejectedTitle" values={ Object { - "listingLink": listing1 title - , + , } } /> diff --git a/src/components/PaginationLinks/__snapshots__/PaginationLinks.test.js.snap b/src/components/PaginationLinks/__snapshots__/PaginationLinks.test.js.snap index fb529177..0726418c 100644 --- a/src/components/PaginationLinks/__snapshots__/PaginationLinks.test.js.snap +++ b/src/components/PaginationLinks/__snapshots__/PaginationLinks.test.js.snap @@ -8,7 +8,7 @@ exports[`PaginationLinks should match snapshot with both links disabled 1`] = `
- 1 - +
@@ -36,7 +36,7 @@ exports[`PaginationLinks should match snapshot with both links disabled 1`] = ` exports[`PaginationLinks should match snapshot with both links enabled 1`] = ` `; @@ -132,7 +132,7 @@ exports[`PaginationLinks should match snapshot with prev disabled and next enabl
- 1 - - + 2 - - + 3 - +
- - + `; exports[`PaginationLinks should match snapshot with prev enabled and next disabled 1`] = `