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 = (