A React utility to simplify testing the output of shallow rendered components.
- Install with NPM -
npm install --save react-shallow-output
var shallowOutput = require('react-shallow-output');
var Component = require('component');
describe('Component', function () {
it('should return true is attribute is set', function () {
var shallowComponent = shallowOutput(Component, {attribute: true});
expect(shallowComponent.props.attribute).to.equal(true); //=> true
});
});
Property | Type | Argument | Default | Description |
---|---|---|---|---|
component | `string | Component` | <required> |
null |
props | object |
<required> |
null |
props to pass to the component. |
children | array |
<optional> |
null |
children to pass to the component. |
react-shallow-output is built using ES6. Run the following task to compile the src/
into dist/
.
npm run build
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.
Copyright (c) 2015 Jason Bellamy & Simon Smith
Licensed under the MIT license.