diff --git a/__tests__/renderEmail.test.js b/__tests__/renderEmail.test.js index c2c4626..c3b2894 100644 --- a/__tests__/renderEmail.test.js +++ b/__tests__/renderEmail.test.js @@ -1,5 +1,6 @@ import React from 'react' import kitchenSink from '../examples/kitchenSink' +import outlookKitchenSink from '../examples/outlookKitchenSink' import { A } from '../src/index' describe('renderEmail', () => { @@ -17,6 +18,12 @@ describe('renderEmail', () => { expect(actualOutput).toBe(expectedOutput) }) + it('produces expected output from a outlook kitchen sink example', () => { + const actualOutput = renderEmail(outlookKitchenSink) + const expectedOutput = 'Test Email
Hello, world!
' + expect(actualOutput).toBe(expectedOutput) + }) + it('warns on usage of an unsupported property', () => { const spy = jest.spyOn(console, 'error').mockImplementation() const actualOutput = renderEmail() diff --git a/examples/outlookKitchenSink.jsx b/examples/outlookKitchenSink.jsx new file mode 100644 index 0000000..d246557 --- /dev/null +++ b/examples/outlookKitchenSink.jsx @@ -0,0 +1,14 @@ +import React from 'react' +import { Email, Item, Span } from '../src/index' + +const heads = + +const email = ( + + + Hello, world! + + +) + +export default email diff --git a/src/components/Email.jsx b/src/components/Email.jsx index 8c51e9b..0c7ecfe 100644 --- a/src/components/Email.jsx +++ b/src/components/Email.jsx @@ -12,6 +12,7 @@ export default function Email(props) { + {props.heads} {props.title} {props.headCSS && } @@ -50,6 +51,7 @@ Email.propTypes = { valign: PropTypes.oneOf(['top', 'middle', 'bottom']), bodyStyle: EmailPropTypes.style, children: PropTypes.node, + heads: PropTypes.node, } Email.defaultProps = { @@ -64,4 +66,5 @@ Email.defaultProps = { headCSS: undefined, bodyStyle: undefined, children: undefined, + heads: undefined, }