0.2.0 • Published 8 years ago

react-shallow-output v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

react-shallow-output

A React utility to simplify testing the output of shallow rendered components.

Getting Started

  • Install with NPM - npm install --save react-shallow-output

Usage

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
  });
});

Options

PropertyTypeArgumentDefaultDescription
componentstring|Component<required>nullan html tag string or React component.
propsobject<required>nullprops to pass to the component.
childrenarray<optional>nullchildren to pass to the component.

Developing

react-shallow-output is built using ES6. Run the following task to compile the src/ into dist/.

npm run build

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2015 Jason Bellamy & Simon Smith
Licensed under the MIT license.