You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Luke Childs 999607c895 Add usage example 8 years ago
src Allow window to be passed in 8 years ago
test Test componentDidMount fires 8 years ago
.gitignore Initial commit 8 years ago
.travis.yml JSDOM only supports Node 6 and up so that;s all we can support 8 years ago
LICENSE Initial commit 8 years ago
README.md Add usage example 8 years ago
package.json Use JSX in tests 8 years ago

README.md

react-jsdom

Render actual DOM nodes in Node.js

Build Status Coverage Status npm

Install

npm install --save-dev react-jsdom

Usage

const React = require('react');
const ReactJSDOM = require('this');

class TestComponent extends React.Component {
  render() {
    return (
      <div>
        <span>hi</span>
        <span>mum</span>
      </div>
    );
  }

  componentDidMount() {
    console.log('I mounted!');
  }
}

const elem = ReactJSDOM.render(<TestComponent />);
// I mounted!

elem.nodeName;
// 'DIV');
elem.querySelector('span:last-child').textContent
// 'mum'

License

MIT © Luke Childs