React assertion helpers for Chai
npm install chai-react-assertionschai-react-assertions   
=================================
Helper assertions for Chai which makes it easier to test React components.
``sh`
$ npm install chai-react-assertions --save-dev
`javascript
import chai, {expect} from 'chai'
import reactAssertions, {shallowRender} from 'chai-react-assertions'
import React from 'react'
chai.use(reactAssertions)
const renderedTree = shallowRender(
expect(renderedTree).to.contain.elementWithText('This is a test!') === true
expect(renderedTree).to.contain.elementWithProps('span', { children: 'This is a test!' }) === true
`
#### shallowRender(JSX)
Returns an instance of a React tree using the skin-deep library.
#### .elementWithText(textToFind: string)
Tries to find the given text in the rendered children. This will be able to find text which spans across multiple elements, for example:
`javascript
const renderedTree = shallowRender(
Part of this sentence is in
bold!
)
expect(renderedTree).to.contain.elementWithText('Part of this sentence is in bold!') === true
`
#### .elementWithProps(selector: string, props: object?)
Tries to find a rendered component with the given selector and props.
The selector can be the display name of a component, or *` to catch all component types which will find any element based on props.
#### .numberOfElements(selector: string, count: number)
TODO
#### .elementWithStyledText(textToFind: string, style: object|array)
TODO
Licensed under the MIT License.
View the full license here.