unexpected-react
React plugin for the Unexpected assertion library
TODO
expect.addType({
identify: function (obj) { return obj && obj._lifeCycleState; },
inspect: function (value, depth, output, inspect) { output.text('<React.js component...>'); }
});
expect(ReactComponent, 'to have props', { foo: 'bar' });
expect(ReactComponent, 'to have state', { foo: 'bar' });
expect(ReactComponent, 'to have html attributes', { foo: 'bar' });
expect(ReactComponent.refs['menu'], 'to have html attributes', { foo: 'bar' });
expect(ReactComponent, 'to have children', [optionalSelector], 6);
expect(ReactComponent, 'to have children who satisfy', [optionalSelector], function (child) {
expect.it(child, 'to have html attributes', { foo: 'bar' });
});
expect(ReactComponent.refs['modal'], 'to be a component', 'ModalComponent');