gaearon/react-document-title — pull request #2 by pluma (2014-10-23 11:53:38+00:00)
Title: Node compat

I've taken the liberty to add a couple of tests to make sure the component behaves as it should.

You were right about the life cycle implications of `componentDidMount`, apparently `componentDidMount` bubbles up while `componentWillMount` trickles down. I'm guessing this is because `componentDidMount` expects the component's children to be fully initialized and this is the only way to accomplish that.

Instead I've just added a simple `typeof` check to bail out when `document` is not defined. As this is a global variable, `typeof` is the only way to determine its existence without causing a reference error.

I wasn't able to reproduce the issue with `addons.Children.only`, so I've not touched that code.

I've also added a `lint` script so you can run jshint with `npm run lint` without having to install it globally.

Emulating a browser via the `global` module is probably not the most reliable way to test the browser behaviour, but adding a browser test runner as dependency seems overkill.