Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/reactNodeToString.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function reactArrayToJSXString (nodes) {
export default function reactNodeToString (node) {
if (Array.isArray(node)) {
return reactArrayToJSXString(node)
} else if (typeof node === 'string') {
return node
} else {
return reactElementToJSXString(node)
}
Expand Down
2 changes: 2 additions & 0 deletions test/contain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Fixture extends React.Component {
<User index={2} />
<User index={3} />
</li>
<li>Unknown User</li>
</ul>
</div>
)
Expand All @@ -35,6 +36,7 @@ describe('#contain', () => {
it('passes when the actual matches the expected', (wrapper) => {
expect(wrapper).to.contain(<User index={1} />)
expect(wrapper).to.contain(<User index={2} />)
expect(wrapper).to.contain('Unknown User')
}, { render: false })

it('passes negated when the actual does not match the expected', (wrapper) => {
Expand Down
2 changes: 2 additions & 0 deletions test/containMatchingElement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Fixture extends React.Component {
<ul>
<li><User index={1} name='John' /></li>
<li><User index={2} name='Doe' /></li>
<li>Unknown User</li>
</ul>
</div>
)
Expand All @@ -33,6 +34,7 @@ describe('#containMatchingElement', () => {
it('passes when the actual matches the expected', (wrapper) => {
expect(wrapper).to.containMatchingElement(<User name='John' />)
expect(wrapper).to.containMatchingElement(<User name='Doe' />)
expect(wrapper).to.containMatchingElement('Unknown User')
}, { render: false })

it('passes negated when the actual does not match the expected', (wrapper) => {
Expand Down