     # defer adding the then callback so it'll be called after whatever is attached after the return
     _.defer -> promise.then ->
       _.delay( ->
-        React.unmountComponentAtNode(root)
+        ReactDOM.unmountComponentAtNode(root)
         CURRENT_ROUTER_PATH   = '/'
         CURRENT_ROUTER_PARAMS = {}
       , unmountAfter )

# No longer exists, needs further investigation if we're using it
# ReactContext   = require('react/lib/ReactContext')

{Promise}      = require 'es6-promise'
{commonActions} = require './utilities'
sandbox = null
ROUTER = null
CURRENT_ROUTER_PARAMS = null
CURRENT_ROUTER_PATH   = null

# Mock a router for the context
beforeEach ->
  sandbox = sinon.sandbox.create()
  ROUTER  = {
    transitionTo:     sandbox.spy()
    replaceWith:      sandbox.spy()
    blockTransitions: sandbox.spy()
    createHref: sandbox.spy( -> '/' )
  }
afterEach ->
  sandbox.restore()

# A wrapper component to setup the router context
Wrapper = React.createClass
  childContextTypes:
    router: React.PropTypes.object
  getChildContext: ->
    router: ROUTER
  render: ->
    location = createRouterLocation('/')
    React.createElement(LocationBroadcast, value: location,
      React.createElement(@props._wrapped_component,
        _.extend(_.omit(@props, '_wrapped_component'), ref: 'element')
      )
    )

Testing = {
