rut-dom
v2.0.0
Published
React testing for DOM based components.
Downloads
29
Readme
Rut DOM
React DOM testing made easy! Rut DOM is a Rut testing adapter that provides a simple streamlined API for writing component based integration tests.
import { render } from 'rut-dom';
import Input, { InputProps } from '../src/Input';
describe('<Input />', () => {
it('renders an input field', () => {
const { root, update } = render<InputProps>(<Input name="rut" value="foo" />);
expect(root).toHaveProp('name', 'rut');
expect(root).toHaveValue('foo');
expect(root).not.toBeDisabled();
update({ disabled: true });
expect(root).toBeDisabled();
});
});
Requirements
- React 16.9+ (Rut v1)
- React 17+ (Rut v2)
Installation
yarn add --dev rut-dom react react-dom