Skip to content

Commit

Permalink
feat: don't wrap strings, either
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepinho committed Nov 15, 2017
1 parent 0436fb5 commit 95edc69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<MediaQuery query="all">
1231
</MediaQuery>
)
const e = TestUtils.renderIntoDocument(mq)
assert.throws(() => (TestUtils.findRenderedDOMComponentWithTag(e, 'div')), /Did not find exactly one match/)
})
it('renders the wrapper', function () {
const mq = (
<MediaQuery query="all" component="section">
Expand Down

0 comments on commit 95edc69

Please sign in to comment.