From 7d7916baf0e0dd69d085431a1e7b032af9004beb Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 5 Jan 2019 20:16:29 -0500 Subject: [PATCH] Applying Layout component in gatsby-browser --- gatsby-browser.js | 8 + gatsby-ssr.js | 8 + .../Layout/__snapshots__/test.js.snap | 264 ------- src/components/Layout/index.js | 7 +- src/components/Layout/test.js | 9 - .../Metadata/__snapshots__/test.js.snap | 171 +++++ src/components/Metadata/index.js | 15 + src/components/Metadata/test.js | 20 + src/pages/404.js | 7 +- src/pages/__snapshots__/404.test.js.snap | 132 ++-- src/pages/__snapshots__/index.test.js.snap | 24 +- src/pages/__snapshots__/privacy.test.js.snap | 654 +++++++++--------- src/pages/index.js | 7 +- src/pages/privacy.js | 7 +- 14 files changed, 684 insertions(+), 649 deletions(-) create mode 100644 gatsby-ssr.js create mode 100644 src/components/Metadata/__snapshots__/test.js.snap create mode 100644 src/components/Metadata/index.js create mode 100644 src/components/Metadata/test.js diff --git a/gatsby-browser.js b/gatsby-browser.js index 09a1cf8..34e0714 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,8 +1,16 @@ +import React from 'react'; import * as Sentry from '@sentry/browser'; +import Layout from 'components/Layout'; + import 'site.css'; export const onClientEntry = () => { Sentry.getCurrentHub().getClient().getOptions().enabled = (navigator.doNotTrack !== '1' && window.doNotTrack !== '1'); }; + +// eslint-disable-next-line react/prop-types +export const wrapPageElement = ({ element }) => { + return { element }; +}; diff --git a/gatsby-ssr.js b/gatsby-ssr.js new file mode 100644 index 0000000..75ec661 --- /dev/null +++ b/gatsby-ssr.js @@ -0,0 +1,8 @@ +import React from 'react'; + +import Layout from 'components/Layout'; + +// eslint-disable-next-line react/prop-types +export const wrapPageElement = ({ element }) => { + return { element }; +}; diff --git a/src/components/Layout/__snapshots__/test.js.snap b/src/components/Layout/__snapshots__/test.js.snap index 55699cd..8a88786 100644 --- a/src/components/Layout/__snapshots__/test.js.snap +++ b/src/components/Layout/__snapshots__/test.js.snap @@ -20,14 +20,6 @@ ShallowWrapper { "nodeType": "class", "props": Object { "children": Array [ - - - Regexper - - ,
, Example content @@ -37,31 +29,6 @@ ShallowWrapper { }, "ref": null, "rendered": Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "class", - "props": Object { - "children": - Regexper - , - "defer": true, - "encodeSpecialCharacters": true, - }, - "ref": null, - "rendered": Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": "Regexper", - }, - "ref": null, - "rendered": "Regexper", - "type": "title", - }, - "type": [Function], - }, Object { "instance": null, "key": undefined, @@ -101,14 +68,6 @@ ShallowWrapper { "nodeType": "class", "props": Object { "children": Array [ - - - Regexper - - ,
, Example content @@ -118,229 +77,6 @@ ShallowWrapper { }, "ref": null, "rendered": Array [ - Object { - "instance": null, - "key": undefined, - "nodeType": "class", - "props": Object { - "children": - Regexper - , - "defer": true, - "encodeSpecialCharacters": true, - }, - "ref": null, - "rendered": Object { - "instance": null, - "key": undefined, - "nodeType": "host", - "props": Object { - "children": "Regexper", - }, - "ref": null, - "rendered": "Regexper", - "type": "title", - }, - "type": [Function], - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "function", - "props": Object {}, - "ref": null, - "rendered": null, - "type": [Function], - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "class", - "props": Object { - "children": "Example content", - }, - "ref": null, - "rendered": "Example content", - "type": [Function], - }, - Object { - "instance": null, - "key": undefined, - "nodeType": "function", - "props": Object {}, - "ref": null, - "rendered": null, - "type": [Function], - }, - ], - "type": [Function], - }, - ], - Symbol(enzyme.__options__): Object { - "adapter": ReactSixteenAdapter { - "options": Object { - "enableComponentDidUpdateOnSetState": true, - "lifecycles": Object { - "componentDidUpdate": Object { - "onSetState": true, - }, - "getDerivedStateFromProps": true, - "getSnapshotBeforeUpdate": true, - "setState": Object { - "skipsComponentDidUpdateOnNullish": true, - }, - }, - }, - }, - }, -} -`; - -exports[`Layout rendering with a title 1`] = ` -ShallowWrapper { - Symbol(enzyme.__root__): [Circular], - Symbol(enzyme.__unrendered__): - Example content - , - Symbol(enzyme.__renderer__): Object { - "batchedUpdates": [Function], - "getNode": [Function], - "render": [Function], - "simulateError": [Function], - "simulateEvent": [Function], - "unmount": [Function], - }, - Symbol(enzyme.__node__): Object { - "instance": null, - "key": undefined, - "nodeType": "class", - "props": Object { - "children": Array [ - - - Regexper - Testing - - , -
, - - Example content - , -