Browse Source

Test componentWillMount fires

pull/8/head
Luke Childs 8 years ago
parent
commit
7eb09cb5fa
  1. 12
      test/react-jsdom.js

12
test/react-jsdom.js

@ -1,3 +1,5 @@
/* eslint-disable react/prop-types, react/jsx-no-bind */
import test from 'ava';
import Window from 'window';
import React from 'react';
@ -7,6 +9,12 @@ class TestComponent extends React.Component {
render() {
return <div>hi</div>;
}
componentWillMount() {
if (typeof this.props.componentWillMount === 'function') {
this.props.componentWillMount();
}
}
}
test('ReactJSDOM is a object', t => {
@ -34,3 +42,7 @@ test('ReactJSDOM allows window instance to be passed in', t => {
t.is(elem.nodeName, 'DIV');
t.is(elem.textContent, 'hi');
});
test('componentWillMount fires', t => {
ReactJSDOM.render(<TestComponent componentWillMount={() => t.pass()}/>);
});

Loading…
Cancel
Save