Reworking internal component naming for clarity
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Footer rendering implementation 1`] = `
|
||||
exports[`Footer rendering 1`] = `
|
||||
ShallowWrapper {
|
||||
Symbol(enzyme.__root__): [Circular],
|
||||
Symbol(enzyme.__unrendered__): <FooterImpl
|
||||
Symbol(enzyme.__unrendered__): <Footer
|
||||
site={
|
||||
Object {
|
||||
"siteMetadata": Object {
|
||||
@@ -488,77 +488,3 @@ ShallowWrapper {
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Footer rendering with query 1`] = `
|
||||
ShallowWrapper {
|
||||
Symbol(enzyme.__root__): [Circular],
|
||||
Symbol(enzyme.__unrendered__): <Footer />,
|
||||
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": "function",
|
||||
"props": Object {
|
||||
"query": "
|
||||
query FooterQuery {
|
||||
site {
|
||||
siteMetadata {
|
||||
buildId
|
||||
}
|
||||
}
|
||||
}
|
||||
",
|
||||
"render": [Function],
|
||||
},
|
||||
"ref": null,
|
||||
"rendered": null,
|
||||
"type": [MockFunction],
|
||||
},
|
||||
Symbol(enzyme.__nodes__): Array [
|
||||
Object {
|
||||
"instance": null,
|
||||
"key": undefined,
|
||||
"nodeType": "function",
|
||||
"props": Object {
|
||||
"query": "
|
||||
query FooterQuery {
|
||||
site {
|
||||
siteMetadata {
|
||||
buildId
|
||||
}
|
||||
}
|
||||
}
|
||||
",
|
||||
"render": [Function],
|
||||
},
|
||||
"ref": null,
|
||||
"rendered": null,
|
||||
"type": [MockFunction],
|
||||
},
|
||||
],
|
||||
Symbol(enzyme.__options__): Object {
|
||||
"adapter": ReactSixteenAdapter {
|
||||
"options": Object {
|
||||
"enableComponentDidUpdateOnSetState": true,
|
||||
"lifecycles": Object {
|
||||
"componentDidUpdate": Object {
|
||||
"onSetState": true,
|
||||
},
|
||||
"getDerivedStateFromProps": true,
|
||||
"getSnapshotBeforeUpdate": true,
|
||||
"setState": Object {
|
||||
"skipsComponentDidUpdateOnNullish": true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -15,7 +15,7 @@ const query = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const FooterImpl = ({ t, site: { siteMetadata } }) => (
|
||||
export const Footer = ({ t, site: { siteMetadata } }) => (
|
||||
<footer className={ style.footer }>
|
||||
<ul className={ style.list }>
|
||||
<li>
|
||||
@@ -38,7 +38,7 @@ export const FooterImpl = ({ t, site: { siteMetadata } }) => (
|
||||
</footer>
|
||||
);
|
||||
|
||||
FooterImpl.propTypes = {
|
||||
Footer.propTypes = {
|
||||
t: PropTypes.func.isRequired,
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
@@ -47,9 +47,8 @@ FooterImpl.propTypes = {
|
||||
}).isRequired
|
||||
};
|
||||
|
||||
const TranslatedFooter = withNamespaces()(FooterImpl);
|
||||
const Footer = () => <StaticQuery query={ query } render={ data => (
|
||||
<TranslatedFooter { ...data } />
|
||||
) } />;
|
||||
|
||||
export default Footer;
|
||||
export default withNamespaces()(props => (
|
||||
<StaticQuery query={ query } render={ data => (
|
||||
<Footer { ...props } { ...data } />
|
||||
) } />
|
||||
));
|
||||
|
||||
@@ -2,19 +2,12 @@ import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { mockT } from 'i18n';
|
||||
import Footer, { FooterImpl } from 'components/Footer';
|
||||
import { Footer } from 'components/Footer';
|
||||
|
||||
describe('Footer', () => {
|
||||
test('rendering with query', () => {
|
||||
test('rendering', () => {
|
||||
const component = shallow(
|
||||
<Footer />
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('rendering implementation', () => {
|
||||
const component = shallow(
|
||||
<FooterImpl site={{ siteMetadata: { buildId: 'abc-123' } }} t={ mockT } />
|
||||
<Footer site={{ siteMetadata: { buildId: 'abc-123' } }} t={ mockT } />
|
||||
);
|
||||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user