From 95edc69daeffad4a4f8575f544ebd235fada10b3 Mon Sep 17 00:00:00 2001 From: Jesse Pinho Date: Wed, 15 Nov 2017 09:16:53 +0100 Subject: [PATCH] feat: don't wrap strings, either --- src/index.js | 1 - test/index_test.js | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index bca9eb4..e7bc176 100644 --- a/src/index.js +++ b/src/index.js @@ -110,7 +110,6 @@ class MediaQuery extends React.Component { const hasMergeProps = Object.keys(props).length > 0 const childrenCount = React.Children.count(this.props.children) const wrapChildren = this.props.component || - typeof this.props.children === 'string' || this.props.children === undefined if (wrapChildren) { return React.createElement( diff --git a/test/index_test.js b/test/index_test.js index 2f1a8fe..7890688 100644 --- a/test/index_test.js +++ b/test/index_test.js @@ -45,6 +45,15 @@ describe('MediaQuery', function () { const e = TestUtils.renderIntoDocument(mq) assert.isNotFalse(TestUtils.findAllInRenderedTree(e, function () {return true})) }) + it('does not wrap text node', function () { + const mq = ( + + 1231 + + ) + const e = TestUtils.renderIntoDocument(mq) + assert.throws(() => (TestUtils.findRenderedDOMComponentWithTag(e, 'div')), /Did not find exactly one match/) + }) it('renders the wrapper', function () { const mq = (